diff options
author | Rob Bradford <rob@linux.intel.com> | 2013-03-27 15:59:43 +0000 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-03-27 14:42:28 -0400 |
commit | c088e2c01145d05eddb3314de17c8dbec6b8cb62 (patch) | |
tree | 542a2dbf32adb24eedf890f455c5a07b9fd7c666 | |
parent | 32069c09eab9547db3f023fc515e4eba2778efca (diff) |
compositor: Support notifying with absolute position too
With evdev input devices that generate absolute positions we need to provide
an infrastructure in the compositor for supporting those.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=61997
-rw-r--r-- | src/compositor.c | 25 | ||||
-rw-r--r-- | src/compositor.h | 5 | ||||
-rw-r--r-- | src/evdev.c | 2 |
3 files changed, 25 insertions, 7 deletions
diff --git a/src/compositor.c b/src/compositor.c index 3e24295c..d3394726 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1782,17 +1782,15 @@ clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy) } } +/* Takes absolute values */ static void -move_pointer(struct weston_seat *seat, wl_fixed_t dx, wl_fixed_t dy) +move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y) { struct weston_compositor *ec = seat->compositor; struct wl_pointer *pointer = seat->seat.pointer; struct weston_output *output; - wl_fixed_t x, y; int32_t ix, iy; - x = pointer->x + dx; - y = pointer->y + dy; clip_pointer_motion(seat, &x, &y); weston_seat_update_drag_surface(seat, x - pointer->x, y - pointer->y); @@ -1829,7 +1827,24 @@ notify_motion(struct weston_seat *seat, weston_compositor_wake(ec); - move_pointer(seat, dx, dy); + move_pointer(seat, pointer->x + dx, pointer->y + dy); + + interface = pointer->grab->interface; + interface->motion(pointer->grab, time, + pointer->grab->x, pointer->grab->y); +} + +WL_EXPORT void +notify_motion_absolute(struct weston_seat *seat, + uint32_t time, wl_fixed_t x, wl_fixed_t y) +{ + const struct wl_pointer_grab_interface *interface; + struct weston_compositor *ec = seat->compositor; + struct wl_pointer *pointer = seat->seat.pointer; + + weston_compositor_wake(ec); + + move_pointer(seat, x, y); interface = pointer->grab->interface; interface->motion(pointer->grab, time, diff --git a/src/compositor.h b/src/compositor.h index 4cc24d85..dc03aebc 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -556,7 +556,10 @@ weston_surface_activate(struct weston_surface *surface, struct weston_seat *seat); void notify_motion(struct weston_seat *seat, uint32_t time, - wl_fixed_t x, wl_fixed_t y); + wl_fixed_t dx, wl_fixed_t dy); +void +notify_motion_absolute(struct weston_seat *seat, uint32_t time, + wl_fixed_t x, wl_fixed_t y); void notify_button(struct weston_seat *seat, uint32_t time, int32_t button, enum wl_pointer_button_state state); diff --git a/src/evdev.c b/src/evdev.c index d2954b57..2c81d2b1 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -284,7 +284,7 @@ evdev_flush_motion(struct evdev_device *device, uint32_t time) } if (device->pending_events & EVDEV_ABSOLUTE_MOTION) { transform_absolute(device); - notify_motion(master, time, + notify_motion_absolute(master, time, wl_fixed_from_int(device->abs.x), wl_fixed_from_int(device->abs.y)); device->pending_events &= ~EVDEV_ABSOLUTE_MOTION; |