From 9ced4a4f3a3962da8a541a51c1de3ea480412edc Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 21 Nov 2023 13:26:59 +0000 Subject: [PATCH] weston-keyboard: Create input_panel_surface earlier If we only create the input_panel_surface after we've already created the window and tried to get some content for it, then we're never going to enter the input_panel_surface committed handler, so we'll never get the chance to properly map the surface. Follow the other surface types by creating the input-panel surface before we try to attach anything to it. Signed-off-by: Daniel Stone Fixes: bdf2019e ("desktop-shell: Map input panel surfaces before views") --- clients/keyboard.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/clients/keyboard.c b/clients/keyboard.c index e5fa3296..49b94baa 100644 --- a/clients/keyboard.c +++ b/clients/keyboard.c @@ -960,35 +960,19 @@ global_handler(struct display *display, uint32_t name, static void set_toplevel(struct output *output, struct virtual_keyboard *virtual_keyboard) { - struct zwp_input_panel_surface_v1 *ips; - struct keyboard *keyboard = virtual_keyboard->keyboard; - - ips = zwp_input_panel_v1_get_input_panel_surface(virtual_keyboard->input_panel, - window_get_wl_surface(keyboard->window)); - - zwp_input_panel_surface_v1_set_toplevel(ips, + zwp_input_panel_surface_v1_set_toplevel(virtual_keyboard->ips, output_get_wl_output(output), ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM); - virtual_keyboard->toplevel = true; virtual_keyboard->overlay = false; - virtual_keyboard->ips = ips; } static void set_overlay(struct output *output, struct virtual_keyboard *virtual_keyboard) { - struct zwp_input_panel_surface_v1 *ips; - struct keyboard *keyboard = virtual_keyboard->keyboard; - - ips = zwp_input_panel_v1_get_input_panel_surface(virtual_keyboard->input_panel, - window_get_wl_surface(keyboard->window)); - - zwp_input_panel_surface_v1_set_overlay_panel(ips); - + zwp_input_panel_surface_v1_set_overlay_panel(virtual_keyboard->ips); virtual_keyboard->toplevel = false; virtual_keyboard->overlay = true; - virtual_keyboard->ips = ips; } static void @@ -1018,6 +1002,9 @@ keyboard_create(struct virtual_keyboard *virtual_keyboard) keyboard->window = window_create_custom(virtual_keyboard->display); keyboard->widget = window_add_widget(keyboard->window, keyboard); + virtual_keyboard->ips = + zwp_input_panel_v1_get_input_panel_surface(virtual_keyboard->input_panel, + window_get_wl_surface(keyboard->window)); virtual_keyboard->keyboard = keyboard; window_set_title(keyboard->window, "Virtual keyboard");