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/zoom.c b/src/zoom.c
index efc658c..8eb20fe 100644
--- a/src/zoom.c
+++ b/src/zoom.c
@@ -129,11 +129,12 @@
weston_output_update_zoom(struct weston_output *output)
{
struct weston_seat *seat = output->zoom.seat;
+ struct weston_pointer *pointer = weston_seat_get_pointer(seat);
assert(output->zoom.active);
- output->zoom.current.x = seat->pointer->x;
- output->zoom.current.y = seat->pointer->y;
+ output->zoom.current.x = pointer->x;
+ output->zoom.current.y = pointer->y;
weston_zoom_transition(output);
weston_output_update_zoom_transform(output);
@@ -154,13 +155,15 @@
weston_output_activate_zoom(struct weston_output *output,
struct weston_seat *seat)
{
+ struct weston_pointer *pointer = weston_seat_get_pointer(seat);
+
if (output->zoom.active)
return;
output->zoom.active = true;
output->zoom.seat = seat;
output->disable_planes++;
- wl_signal_add(&seat->pointer->motion_signal,
+ wl_signal_add(&pointer->motion_signal,
&output->zoom.motion_listener);
}