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 <daniels@collabora.com>
Fixes: bdf2019e ("desktop-shell: Map input panel surfaces before views")
This commit is contained in:
Daniel Stone 2023-11-21 13:26:59 +00:00
parent bd8a6da2f0
commit 9ced4a4f3a
1 changed files with 5 additions and 18 deletions

View File

@ -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");