shell: Track pointer focus for all seats
diff --git a/src/shell.c b/src/shell.c
index 9c8a8a9..87e688c 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1132,6 +1132,19 @@
}
static void
+create_pointer_focus_listener(struct weston_seat *seat)
+{
+ struct wl_listener *listener;
+
+ if (!seat->seat.pointer)
+ return;
+
+ listener = malloc(sizeof *listener);
+ listener->notify = handle_pointer_focus;
+ wl_signal_add(&seat->seat.pointer->focus_signal, listener);
+}
+
+static void
shell_surface_pong(struct wl_client *client, struct wl_resource *resource,
uint32_t serial)
{
@@ -3357,6 +3370,7 @@
WL_EXPORT int
shell_init(struct weston_compositor *ec)
{
+ struct weston_seat *seat;
struct desktop_shell *shell;
struct workspace **pws;
unsigned int i;
@@ -3434,10 +3448,8 @@
if (launch_desktop_shell_process(shell) != 0)
return -1;
- shell->pointer_focus_listener.notify = handle_pointer_focus;
- if (ec->seat->seat.pointer)
- wl_signal_add(&ec->seat->seat.pointer->focus_signal,
- &shell->pointer_focus_listener);
+ wl_list_for_each(seat, &ec->seat_list, link)
+ create_pointer_focus_listener(seat);
shell_add_bindings(ec, shell);