[PATCH weston] input: make sure the devices get the resource destruction signal
Giulio Camuffo
giuliocamuffo at gmail.com
Fri Dec 6 03:04:54 PST 2013
The device may not have a resource for the client yet, but install
the listeners nevertheless.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=65726
---
src/input.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/input.c b/src/input.c
index e2910ea..14f4bbe 100644
--- a/src/input.c
+++ b/src/input.c
@@ -620,8 +620,6 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
pointer->focus->surface->resource);
}
- wl_list_remove(&pointer->focus_resource_listener.link);
- wl_list_init(&pointer->focus_resource_listener.link);
move_resources(&pointer->resource_list, focus_resource_list);
}
@@ -650,18 +648,20 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
}
pointer->focus_serial = serial;
+ }
+
+ wl_list_remove(&pointer->focus_view_listener.link);
+ wl_list_init(&pointer->focus_view_listener.link);
+ wl_list_remove(&pointer->focus_resource_listener.link);
+ wl_list_init(&pointer->focus_resource_listener.link);
+ if (view) {
+ wl_signal_add(&view->destroy_signal, &pointer->focus_view_listener);
wl_resource_add_destroy_listener(view->surface->resource,
&pointer->focus_resource_listener);
}
- if (!wl_list_empty(&pointer->focus_view_listener.link)) {
- wl_list_remove(&pointer->focus_view_listener.link);
- wl_list_init(&pointer->focus_view_listener.link);
- }
pointer->focus = view;
pointer->focus_view_listener.notify = pointer_focus_view_destroyed;
- if (view)
- wl_signal_add(&view->destroy_signal, &pointer->focus_view_listener);
wl_signal_emit(&pointer->focus_signal, pointer);
}
@@ -698,8 +698,6 @@ weston_keyboard_set_focus(struct weston_keyboard *keyboard,
wl_keyboard_send_leave(resource, serial,
keyboard->focus->resource);
}
- wl_list_remove(&keyboard->focus_resource_listener.link);
- wl_list_init(&keyboard->focus_resource_listener.link);
move_resources(&keyboard->resource_list, focus_resource_list);
}
@@ -718,9 +716,13 @@ weston_keyboard_set_focus(struct weston_keyboard *keyboard,
surface,
serial);
keyboard->focus_serial = serial;
+ }
+
+ wl_list_remove(&keyboard->focus_resource_listener.link);
+ wl_list_init(&keyboard->focus_resource_listener.link);
+ if (surface)
wl_resource_add_destroy_listener(surface->resource,
&keyboard->focus_resource_listener);
- }
keyboard->focus = surface;
wl_signal_emit(&keyboard->focus_signal, keyboard);
--
1.8.4.2
More information about the wayland-devel
mailing list