input: Don't test keyboard/pointer/touch pointers
Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.
This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ã…dahl <jadahl@gmail.com>
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 3cb6b84..2aab691 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -2075,6 +2075,7 @@
const char *s)
{
if (strcmp(s, "") != 0) {
+ struct weston_pointer *pointer;
struct udev_seat *seat;
seat = udev_seat_get_named(&b->input, s);
@@ -2083,10 +2084,11 @@
seat->base.output = output;
- if (seat->base.pointer)
- weston_pointer_clamp(seat->base.pointer,
- &seat->base.pointer->x,
- &seat->base.pointer->y);
+ pointer = weston_seat_get_pointer(&seat->base);
+ if (pointer)
+ weston_pointer_clamp(pointer,
+ &pointer->x,
+ &pointer->y);
}
}