diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2015-07-22 12:05:38 +0800 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2015-11-20 11:52:19 +0800 |
commit | 2cbf293b0551357ae36757788e385e391f971386 (patch) | |
tree | 17cb08914fb3b1b98e5bb81c337a78f13d008885 /desktop-shell | |
parent | 8283c343ec0b21c88edc7dbfaafbc2ed53d78d61 (diff) |
input: Keep per client pointer resources in their own structs
Keep all per client wl_pointer resources in a new struct called
'weston_pointer_client'. When focus changes, instead of moving a list
of resources between different lists, just change the focused pointer
client.
The intention with this is to make it easier to add wl_pointer
extensions that share the same focus as the corresponding wl_pointer.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'desktop-shell')
-rw-r--r-- | desktop-shell/shell.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index d58a830b..780902d0 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -3145,6 +3145,7 @@ popup_grab_motion(struct weston_pointer_grab *grab, uint32_t time, { struct weston_pointer *pointer = grab->pointer; struct wl_resource *resource; + struct wl_list *resource_list; wl_fixed_t x, y; wl_fixed_t sx, sy; @@ -3156,7 +3157,11 @@ popup_grab_motion(struct weston_pointer_grab *grab, uint32_t time, weston_pointer_move(pointer, event); - wl_resource_for_each(resource, &pointer->focus_resource_list) { + if (!pointer->focus_client) + return; + + resource_list = &pointer->focus_client->pointer_resources; + wl_resource_for_each(resource, resource_list) { weston_view_from_global_fixed(pointer->focus, pointer->x, pointer->y, &sx, &sy); @@ -3174,10 +3179,11 @@ popup_grab_button(struct weston_pointer_grab *grab, struct wl_display *display = shseat->seat->compositor->wl_display; enum wl_pointer_button_state state = state_w; uint32_t serial; - struct wl_list *resource_list; + struct wl_list *resource_list = NULL; - resource_list = &grab->pointer->focus_resource_list; - if (!wl_list_empty(resource_list)) { + if (grab->pointer->focus_client) + resource_list = &grab->pointer->focus_client->pointer_resources; + if (resource_list && !wl_list_empty(resource_list)) { serial = wl_display_get_serial(display); wl_resource_for_each(resource, resource_list) { wl_pointer_send_button(resource, serial, |