summaryrefslogtreecommitdiff
path: root/xwayland
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 /xwayland
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 'xwayland')
-rw-r--r--xwayland/dnd.c3
-rw-r--r--xwayland/window-manager.c23
2 files changed, 16 insertions, 10 deletions
diff --git a/xwayland/dnd.c b/xwayland/dnd.c
index eb9c5dd1..a036b30f 100644
--- a/xwayland/dnd.c
+++ b/xwayland/dnd.c
@@ -154,6 +154,7 @@ handle_enter(struct weston_wm *wm, xcb_client_message_event_t *client_message)
{
struct dnd_data_source *source;
struct weston_seat *seat = weston_wm_pick_seat(wm);
+ struct weston_pointer *pointer = weston_seat_get_pointer(seat);
char **p;
const char *name;
uint32_t *types;
@@ -213,7 +214,7 @@ handle_enter(struct weston_wm *wm, xcb_client_message_event_t *client_message)
}
free(reply);
- weston_pointer_start_drag(seat->pointer, &source->base, NULL, NULL);
+ weston_pointer_start_drag(pointer, &source->base, NULL, NULL);
}
int
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index c3a57c19..daebf47d 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -1316,12 +1316,16 @@ weston_wm_pick_seat_for_window(struct weston_wm_window *window)
seat = NULL;
wl_list_for_each(s, &wm->server->compositor->seat_list, link) {
- if (s->pointer != NULL && s->pointer->focus &&
- s->pointer->focus->surface == window->surface &&
- s->pointer->button_count > 0 &&
- (seat == NULL ||
- s->pointer->grab_serial -
- seat->pointer->grab_serial < (1 << 30)))
+ struct weston_pointer *pointer = weston_seat_get_pointer(s);
+ struct weston_pointer *old_pointer =
+ weston_seat_get_pointer(seat);
+
+ if (pointer && pointer->focus &&
+ pointer->focus->surface == window->surface &&
+ pointer->button_count > 0 &&
+ (!seat ||
+ pointer->grab_serial -
+ old_pointer->grab_serial < (1 << 30)))
seat = s;
}
@@ -1345,13 +1349,14 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
struct weston_wm *wm = window->wm;
struct weston_seat *seat = weston_wm_pick_seat_for_window(window);
+ struct weston_pointer *pointer = weston_seat_get_pointer(seat);
int detail;
struct weston_shell_interface *shell_interface =
&wm->server->compositor->shell_interface;
- if (seat == NULL || seat->pointer->button_count != 1
- || !seat->pointer->focus
- || seat->pointer->focus->surface != window->surface)
+ if (!pointer || pointer->button_count != 1
+ || !pointer->focus
+ || pointer->focus->surface != window->surface)
return;
detail = client_message->data.data32[2];