diff --git a/clients/keyboard.c b/clients/keyboard.c index 92525dae..b2ef2db9 100644 --- a/clients/keyboard.c +++ b/clients/keyboard.c @@ -60,6 +60,7 @@ struct virtual_keyboard { uint32_t surrounding_cursor; struct keyboard *keyboard; bool toplevel; + bool overlay; struct zwp_input_panel_surface_v1 *ips; }; @@ -970,15 +971,38 @@ set_toplevel(struct output *output, struct virtual_keyboard *virtual_keyboard) 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); + + virtual_keyboard->toplevel = false; + virtual_keyboard->overlay = true; virtual_keyboard->ips = ips; } static void display_output_handler(struct output *output, void *data) { struct virtual_keyboard *keyboard = data; + const char *type = getenv("WESTON_KEYBOARD_SURFACE_TYPE"); - if (!keyboard->toplevel) - set_toplevel(output, keyboard); + if (type && strcasecmp("overlay", type) == 0) { + if (!keyboard->overlay) + set_overlay(output, keyboard); + } else { + if (!keyboard->toplevel) + set_toplevel(output, keyboard); + } } static void diff --git a/compositor/text-backend.c b/compositor/text-backend.c index f2781685..1a5c7fd2 100644 --- a/compositor/text-backend.c +++ b/compositor/text-backend.c @@ -103,6 +103,7 @@ struct text_backend { struct { char *path; + bool overlay_keyboard; struct wl_client *client; unsigned deathcount; @@ -993,6 +994,9 @@ launch_input_method(struct text_backend *text_backend) if (strcmp(text_backend->input_method.path, "") == 0) return; + if (text_backend->input_method.overlay_keyboard) + setenv("WESTON_KEYBOARD_SURFACE_TYPE", "overlay", 1); + text_backend->input_method.client = weston_client_start(text_backend->compositor, text_backend->input_method.path); @@ -1060,6 +1064,9 @@ text_backend_configuration(struct text_backend *text_backend) weston_config_section_get_string(section, "path", &text_backend->input_method.path, client); + weston_config_section_get_bool(section, "overlay-keyboard", + &text_backend->input_method.overlay_keyboard, + false); free(client); } diff --git a/man/weston.ini.man b/man/weston.ini.man index 8935de17..014a805e 100644 --- a/man/weston.ini.man +++ b/man/weston.ini.man @@ -574,6 +574,11 @@ request. Currently, this option is supported by kiosk-shell. sets the path of the on screen keyboard input method (string). .RE .RE +.TP 7 +.BI "overlay-keyboard=" false +sets weston-keyboard as overlay panel. +.RE +.RE .SH "KEYBOARD SECTION" This section contains the following keys: .TP 7