summaryrefslogtreecommitdiff
path: root/fullscreen-shell
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 /fullscreen-shell
parentb41b59e2fae83124f90ce54b6ae3f088bfec3338 (diff)
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 'fullscreen-shell')
-rw-r--r--fullscreen-shell/fullscreen-shell.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index cae6ed5f..ef9302bc 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -96,15 +96,17 @@ static void
seat_caps_changed(struct wl_listener *l, void *data)
{
struct weston_seat *seat = data;
+ struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
+ struct weston_pointer *pointer = weston_seat_get_pointer(seat);
struct pointer_focus_listener *listener;
struct fs_output *fsout;
listener = container_of(l, struct pointer_focus_listener, seat_caps);
/* no pointer */
- if (seat->pointer_device_count) {
+ if (pointer) {
if (!listener->pointer_focus.link.prev) {
- wl_signal_add(&seat->pointer->focus_signal,
+ wl_signal_add(&pointer->focus_signal,
&listener->pointer_focus);
}
} else {
@@ -113,7 +115,7 @@ seat_caps_changed(struct wl_listener *l, void *data)
}
}
- if (seat->keyboard_device_count && seat->keyboard->focus != NULL) {
+ if (keyboard && keyboard->focus != NULL) {
wl_list_for_each(fsout, &listener->shell->output_list, link) {
if (fsout->surface) {
weston_surface_activate(fsout->surface, seat);
@@ -681,7 +683,10 @@ fullscreen_shell_present_surface(struct wl_client *client,
if (surface) {
wl_list_for_each(seat, &shell->compositor->seat_list, link) {
- if (seat->keyboard && seat->keyboard->focus == NULL)
+ struct weston_keyboard *keyboard =
+ weston_seat_get_keyboard(seat);
+
+ if (keyboard && !keyboard->focus)
weston_surface_activate(surface, seat);
}
}
@@ -729,7 +734,10 @@ fullscreen_shell_present_surface_for_mode(struct wl_client *client,
fsout, mode_feedback_destroyed);
wl_list_for_each(seat, &shell->compositor->seat_list, link) {
- if (seat->keyboard && seat->keyboard->focus == NULL)
+ struct weston_keyboard *keyboard =
+ weston_seat_get_keyboard(seat);
+
+ if (keyboard && !keyboard->focus)
weston_surface_activate(surface, seat);
}
}