[PATCH weston 13/17] input: Check device counts in bind_seat()

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


We shouldn't be using seat->pointer|keyboard|touch here, we should be
testing *_device_count to see if a device is currently present.

Testing the pointers directly will result in incorrectly advertising
capabilities after all devices of a type have been removed.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 src/input.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/input.c b/src/input.c
index 1d7e705..bbcaec5 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1901,11 +1901,11 @@ bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
 	wl_resource_set_implementation(resource, &seat_interface, data,
 				       unbind_resource);
 
-	if (seat->pointer)
+	if (seat->pointer_device_count)
 		caps |= WL_SEAT_CAPABILITY_POINTER;
-	if (seat->keyboard)
+	if (seat->keyboard_device_count)
 		caps |= WL_SEAT_CAPABILITY_KEYBOARD;
-	if (seat->touch)
+	if (seat->touch_device_count)
 		caps |= WL_SEAT_CAPABILITY_TOUCH;
 
 	wl_seat_send_capabilities(resource, caps);
-- 
2.1.4



More information about the wayland-devel mailing list