shell: display the input panel on the active output

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

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=71015

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c
index 601b289..7623f6c 100644
--- a/desktop-shell/input-panel.c
+++ b/desktop-shell/input-panel.c
@@ -61,6 +61,19 @@
 show_input_panel_surface(struct input_panel_surface *ipsurf)
 {
 	struct desktop_shell *shell = ipsurf->shell;
+	struct weston_seat *seat;
+	struct weston_surface *focus;
+	float x, y;
+
+	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);