weston-keyboard: Enable to set as overlay panel
input-method-v1 protocol provides two surface type for the input panel, `toplevel` and `overlay`. But there is no example for the later one. This change enables to set weston-keyboard as overlay panel by the environment variable `WESTON_KEYBOARD_SURFACE_TYPE=overlay` to demonstrate this feature. In Addition, add weston.ini option `overlay-keyboard` to set it. Signed-off-by: Takuro Ashie <ashie@clear-code.com>
This commit is contained in:
+26
-2
@@ -60,6 +60,7 @@ struct virtual_keyboard {
|
|||||||
uint32_t surrounding_cursor;
|
uint32_t surrounding_cursor;
|
||||||
struct keyboard *keyboard;
|
struct keyboard *keyboard;
|
||||||
bool toplevel;
|
bool toplevel;
|
||||||
|
bool overlay;
|
||||||
struct zwp_input_panel_surface_v1 *ips;
|
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);
|
ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
|
||||||
|
|
||||||
virtual_keyboard->toplevel = true;
|
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;
|
virtual_keyboard->ips = ips;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
display_output_handler(struct output *output, void *data) {
|
display_output_handler(struct output *output, void *data) {
|
||||||
struct virtual_keyboard *keyboard = data;
|
struct virtual_keyboard *keyboard = data;
|
||||||
|
const char *type = getenv("WESTON_KEYBOARD_SURFACE_TYPE");
|
||||||
|
|
||||||
if (!keyboard->toplevel)
|
if (type && strcasecmp("overlay", type) == 0) {
|
||||||
set_toplevel(output, keyboard);
|
if (!keyboard->overlay)
|
||||||
|
set_overlay(output, keyboard);
|
||||||
|
} else {
|
||||||
|
if (!keyboard->toplevel)
|
||||||
|
set_toplevel(output, keyboard);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ struct text_backend {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
char *path;
|
char *path;
|
||||||
|
bool overlay_keyboard;
|
||||||
struct wl_client *client;
|
struct wl_client *client;
|
||||||
|
|
||||||
unsigned deathcount;
|
unsigned deathcount;
|
||||||
@@ -993,6 +994,9 @@ launch_input_method(struct text_backend *text_backend)
|
|||||||
if (strcmp(text_backend->input_method.path, "") == 0)
|
if (strcmp(text_backend->input_method.path, "") == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (text_backend->input_method.overlay_keyboard)
|
||||||
|
setenv("WESTON_KEYBOARD_SURFACE_TYPE", "overlay", 1);
|
||||||
|
|
||||||
text_backend->input_method.client =
|
text_backend->input_method.client =
|
||||||
weston_client_start(text_backend->compositor,
|
weston_client_start(text_backend->compositor,
|
||||||
text_backend->input_method.path);
|
text_backend->input_method.path);
|
||||||
@@ -1060,6 +1064,9 @@ text_backend_configuration(struct text_backend *text_backend)
|
|||||||
weston_config_section_get_string(section, "path",
|
weston_config_section_get_string(section, "path",
|
||||||
&text_backend->input_method.path,
|
&text_backend->input_method.path,
|
||||||
client);
|
client);
|
||||||
|
weston_config_section_get_bool(section, "overlay-keyboard",
|
||||||
|
&text_backend->input_method.overlay_keyboard,
|
||||||
|
false);
|
||||||
free(client);
|
free(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -574,6 +574,11 @@ request. Currently, this option is supported by kiosk-shell.
|
|||||||
sets the path of the on screen keyboard input method (string).
|
sets the path of the on screen keyboard input method (string).
|
||||||
.RE
|
.RE
|
||||||
.RE
|
.RE
|
||||||
|
.TP 7
|
||||||
|
.BI "overlay-keyboard=" false
|
||||||
|
sets weston-keyboard as overlay panel.
|
||||||
|
.RE
|
||||||
|
.RE
|
||||||
.SH "KEYBOARD SECTION"
|
.SH "KEYBOARD SECTION"
|
||||||
This section contains the following keys:
|
This section contains the following keys:
|
||||||
.TP 7
|
.TP 7
|
||||||
|
|||||||
Reference in New Issue
Block a user