[PATCH] shell: display the input panel on the active output

Manuel Bachmann manuel.bachmann at open.eurogiciel.org
Thu Apr 17 05:04:32 PDT 2014


We now dynamically move the input panel (i.e. virtual
keyboard) surface to the output containing the currently
focused surface.

Signed-off-by: Manuel Bachmann <manuel.bachmann at open.eurogiciel.org>
---
 desktop-shell/input-panel.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c
index 12fe686..d5e7d71 100644
--- a/desktop-shell/input-panel.c
+++ b/desktop-shell/input-panel.c
@@ -54,6 +54,9 @@ show_input_panels(struct wl_listener *listener, void *data)
 		container_of(listener, struct desktop_shell,
 			     show_input_panel_listener);
 	struct input_panel_surface *ipsurf, *next;
+	struct weston_seat *seat;
+	struct weston_surface *focus;
+	float x, y;
 
 	shell->text_input.surface = (struct weston_surface*)data;
 
@@ -70,6 +73,17 @@ show_input_panels(struct wl_listener *listener, void *data)
 			      &shell->input_panel.surfaces, link) {
 		if (ipsurf->surface->width == 0)
 			continue;
+
+		wl_list_for_each(seat, &shell->compositor->seat_list, link) {
+			if (!seat->keyboard)
+				continue;
+			focus = weston_surface_get_main_surface(seat->keyboard->focus);
+			ipsurf->output = focus->output;
+			x = ipsurf->output->x + (ipsurf->output->width - ipsurf->surface->width) / 2;
+			y = ipsurf->output->y + ipsurf->output->height - ipsurf->surface->height;
+			weston_view_set_position(ipsurf->view, x, y);
+		}
+
 		wl_list_insert(&shell->input_panel_layer.view_list,
 			       &ipsurf->view->layer_link);
 		weston_view_geometry_dirty(ipsurf->view);
-- 
1.7.10.4



More information about the wayland-devel mailing list