[PATCH] add notify_motion_absolute for absolute motion devices
U. Artie Eoff
ullysses.a.eoff at intel.com
Fri Mar 22 09:10:34 PDT 2013
From: "U. Artie Eoff" <ullysses.a.eoff at intel.com>
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=61997
Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
---
src/compositor.c | 29 +++++++++++++++++++++++++----
src/compositor.h | 7 ++++++-
src/evdev.c | 2 +-
3 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index b734f67..ce5c788 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1783,16 +1783,13 @@ clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy)
}
static void
-move_pointer(struct weston_seat *seat, wl_fixed_t dx, wl_fixed_t dy)
+move_pointer_absolute(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);
@@ -1819,6 +1816,13 @@ move_pointer(struct weston_seat *seat, wl_fixed_t dx, wl_fixed_t dy)
}
}
+static void
+move_pointer(struct weston_seat *seat, wl_fixed_t dx, wl_fixed_t dy)
+{
+ struct wl_pointer *pointer = seat->seat.pointer;
+ move_pointer_absolute(seat, pointer->x + dx, pointer->y + dy);
+}
+
WL_EXPORT void
notify_motion(struct weston_seat *seat,
uint32_t time, wl_fixed_t dx, wl_fixed_t dy)
@@ -1837,6 +1841,23 @@ notify_motion(struct weston_seat *seat,
}
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_absolute(seat, x, y);
+
+ interface = pointer->grab->interface;
+ interface->motion(pointer->grab, time,
+ pointer->grab->x, pointer->grab->y);
+}
+
+WL_EXPORT void
weston_surface_activate(struct weston_surface *surface,
struct weston_seat *seat)
{
diff --git a/src/compositor.h b/src/compositor.h
index 58ab58d..c1efe0f 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -555,7 +555,12 @@ 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 d2954b5..2c81d2b 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;
--
1.7.11.7
More information about the wayland-devel
mailing list