[PATCH weston 16/17] fullscreen-shell: Test for device presence properly

Derek Foreman derekf at osg.samsung.com
Wed Jul 15 11:00:47 PDT 2015


We should be testing device counts, not pointers.  The pointers are
persistent state that never gets freed, and are an inaccurate indicator
of device presence after the last release.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 fullscreen-shell/fullscreen-shell.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index ab9c420..cae6ed5 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -102,7 +102,7 @@ seat_caps_changed(struct wl_listener *l, void *data)
 	listener = container_of(l, struct pointer_focus_listener, seat_caps);
 
 	/* no pointer */
-	if (seat->pointer) {
+	if (seat->pointer_device_count) {
 		if (!listener->pointer_focus.link.prev) {
 			wl_signal_add(&seat->pointer->focus_signal,
 				      &listener->pointer_focus);
@@ -113,7 +113,7 @@ seat_caps_changed(struct wl_listener *l, void *data)
 		}
 	}
 
-	if (seat->keyboard && seat->keyboard->focus != NULL) {
+	if (seat->keyboard_device_count && seat->keyboard->focus != NULL) {
 		wl_list_for_each(fsout, &listener->shell->output_list, link) {
 			if (fsout->surface) {
 				weston_surface_activate(fsout->surface, seat);
-- 
2.1.4



More information about the wayland-devel mailing list