diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2016-07-22 17:54:55 +0800 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2016-07-26 17:21:15 +0800 |
commit | f44942ea04263e4137583e380ebe7ab27adf5c71 (patch) | |
tree | 20b06b3c7bdb6e9cd52bca43dbe9df2d9528ff90 /libweston | |
parent | 3eb4ddd24d5e9fcf3cb7e0cdeeceefa6619fe8c0 (diff) |
input: Split out motion sending from default grab
We'll reuse it later.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'libweston')
-rw-r--r-- | libweston/input.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/libweston/input.c b/libweston/input.c index b559656e..b774d56d 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -340,12 +340,25 @@ weston_pointer_send_relative_motion(struct weston_pointer *pointer, } static void +weston_pointer_send_motion(struct weston_pointer *pointer, uint32_t time, + wl_fixed_t sx, wl_fixed_t sy) +{ + struct wl_list *resource_list; + struct wl_resource *resource; + + if (!pointer->focus_client) + return; + + resource_list = &pointer->focus_client->pointer_resources; + wl_resource_for_each(resource, resource_list) + wl_pointer_send_motion(resource, time, sx, sy); +} + +static void default_grab_pointer_motion(struct weston_pointer_grab *grab, uint32_t time, struct weston_pointer_motion_event *event) { struct weston_pointer *pointer = grab->pointer; - struct wl_list *resource_list; - struct wl_resource *resource; wl_fixed_t x, y; wl_fixed_t old_sx = pointer->sx; wl_fixed_t old_sy = pointer->sy; @@ -358,13 +371,9 @@ default_grab_pointer_motion(struct weston_pointer_grab *grab, uint32_t time, weston_pointer_move(pointer, event); - if (pointer->focus_client && - (old_sx != pointer->sx || old_sy != pointer->sy)) { - resource_list = &pointer->focus_client->pointer_resources; - wl_resource_for_each(resource, resource_list) { - wl_pointer_send_motion(resource, time, - pointer->sx, pointer->sy); - } + if (old_sx != pointer->sx || old_sy != pointer->sy) { + weston_pointer_send_motion(pointer, time, + pointer->sx, pointer->sy); } weston_pointer_send_relative_motion(pointer, time, event); |