summaryrefslogtreecommitdiff
path: root/src/compositor.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-07-31 16:55:32 -0500
committerBryce Harrington <bryce@osg.samsung.com>2015-07-31 15:16:09 -0700
commit1281a36e3bcd27345bd4a107f282213ecca56f0e (patch)
tree5d797ffcd96f5542da153bec095a1c7800ce9cda /src/compositor.c
parentb41b59e2fae83124f90ce54b6ae3f088bfec3338 (diff)
downloadweston-1281a36e3bcd27345bd4a107f282213ecca56f0e.tar.gz
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>
Diffstat (limited to 'src/compositor.c')
-rw-r--r--src/compositor.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 66c3eeee..541829ca 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -95,7 +95,7 @@ static void weston_mode_switch_finish(struct weston_output *output,
/* If a pointer falls outside the outputs new geometry, move it to its
* lower-right corner */
wl_list_for_each(seat, &output->compositor->seat_list, link) {
- struct weston_pointer *pointer = seat->pointer;
+ struct weston_pointer *pointer = weston_seat_get_pointer(seat);
int32_t x, y;
if (!pointer)
@@ -1752,15 +1752,20 @@ weston_view_unmap(struct weston_view *view)
return;
wl_list_for_each(seat, &view->surface->compositor->seat_list, link) {
- if (seat->keyboard && seat->keyboard->focus == view->surface)
- weston_keyboard_set_focus(seat->keyboard, NULL);
- if (seat->pointer && seat->pointer->focus == view)
- weston_pointer_set_focus(seat->pointer,
+ struct weston_touch *touch = weston_seat_get_touch(seat);
+ struct weston_pointer *pointer = weston_seat_get_pointer(seat);
+ struct weston_keyboard *keyboard =
+ weston_seat_get_keyboard(seat);
+
+ if (keyboard && keyboard->focus == view->surface)
+ weston_keyboard_set_focus(keyboard, NULL);
+ if (pointer && pointer->focus == view)
+ weston_pointer_set_focus(pointer,
NULL,
wl_fixed_from_int(0),
wl_fixed_from_int(0));
- if (seat->touch && seat->touch->focus == view)
- weston_touch_set_focus(seat->touch, NULL);
+ if (touch && touch->focus == view)
+ weston_touch_set_focus(touch, NULL);
}
}
@@ -4587,10 +4592,10 @@ weston_compositor_set_default_pointer_grab(struct weston_compositor *ec,
ec->default_pointer_grab = interface;
wl_list_for_each(seat, &ec->seat_list, link) {
- if (seat->pointer) {
- weston_pointer_set_default_grab(seat->pointer,
- interface);
- }
+ struct weston_pointer *pointer = weston_seat_get_pointer(seat);
+
+ if (pointer)
+ weston_pointer_set_default_grab(pointer, interface);
}
}