summaryrefslogtreecommitdiff
path: root/desktop-shell
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2014-10-05 21:39:14 +0200
committerJonas Ådahl <jadahl@gmail.com>2015-11-20 11:44:56 +0800
commitd2510105a6e411790f3d5bd3acd1e0d0e295ff06 (patch)
tree69857f69085216be3028c0a60ef8c9ac5d2a26d6 /desktop-shell
parent870fadced3f19659b60574888432b79713776097 (diff)
downloadweston-d2510105a6e411790f3d5bd3acd1e0d0e295ff06.tar.gz
input: Make pointer grab motion callbacks take an event struct
Instead of only passing absolute pointer coordinates, effectively loosing motion event data, pass a struct that can potentially contain different types of motion events, currently being absolute and relative. A helper function to get resulting absolute coordinates was added for when previous callbacks simply used the (x, y) coordinates. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Diffstat (limited to 'desktop-shell')
-rw-r--r--desktop-shell/exposay.c4
-rw-r--r--desktop-shell/shell.c22
2 files changed, 14 insertions, 12 deletions
diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
index eb4070e2..8bd55fbf 100644
--- a/desktop-shell/exposay.c
+++ b/desktop-shell/exposay.c
@@ -348,12 +348,12 @@ exposay_focus(struct weston_pointer_grab *grab)
static void
exposay_motion(struct weston_pointer_grab *grab, uint32_t time,
- wl_fixed_t x, wl_fixed_t y)
+ struct weston_pointer_motion_event *event)
{
struct desktop_shell *shell =
container_of(grab, struct desktop_shell, exposay.grab_ptr);
- weston_pointer_move(grab->pointer, x, y);
+ weston_pointer_move(grab->pointer, event);
exposay_pick(shell,
wl_fixed_to_int(grab->pointer->x),
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 00c3260b..d58a830b 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1632,14 +1632,14 @@ constrain_position(struct weston_move_grab *move, int *cx, int *cy)
static void
move_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
- wl_fixed_t x, wl_fixed_t y)
+ struct weston_pointer_motion_event *event)
{
struct weston_move_grab *move = (struct weston_move_grab *) grab;
struct weston_pointer *pointer = grab->pointer;
struct shell_surface *shsurf = move->base.shsurf;
int cx, cy;
- weston_pointer_move(pointer, x, y);
+ weston_pointer_move(pointer, event);
if (!shsurf)
return;
@@ -1758,7 +1758,7 @@ struct weston_resize_grab {
static void
resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
- wl_fixed_t x, wl_fixed_t y)
+ struct weston_pointer_motion_event *event)
{
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
struct weston_pointer *pointer = grab->pointer;
@@ -1767,7 +1767,7 @@ resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
wl_fixed_t from_x, from_y;
wl_fixed_t to_x, to_y;
- weston_pointer_move(pointer, x, y);
+ weston_pointer_move(pointer, event);
if (!shsurf)
return;
@@ -1973,9 +1973,9 @@ busy_cursor_grab_focus(struct weston_pointer_grab *base)
static void
busy_cursor_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
- wl_fixed_t x, wl_fixed_t y)
+ struct weston_pointer_motion_event *event)
{
- weston_pointer_move(grab->pointer, x, y);
+ weston_pointer_move(grab->pointer, event);
}
static void
@@ -3141,18 +3141,20 @@ popup_grab_focus(struct weston_pointer_grab *grab)
static void
popup_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
- wl_fixed_t x, wl_fixed_t y)
+ struct weston_pointer_motion_event *event)
{
struct weston_pointer *pointer = grab->pointer;
struct wl_resource *resource;
+ wl_fixed_t x, y;
wl_fixed_t sx, sy;
if (pointer->focus) {
+ weston_pointer_motion_to_abs(pointer, event, &x, &y);
weston_view_from_global_fixed(pointer->focus, x, y,
&pointer->sx, &pointer->sy);
}
- weston_pointer_move(pointer, x, y);
+ weston_pointer_move(pointer, event);
wl_resource_for_each(resource, &pointer->focus_resource_list) {
weston_view_from_global_fixed(pointer->focus,
@@ -4812,7 +4814,7 @@ terminate_binding(struct weston_keyboard *keyboard, uint32_t time,
static void
rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
- wl_fixed_t x, wl_fixed_t y)
+ struct weston_pointer_motion_event *event)
{
struct rotate_grab *rotate =
container_of(grab, struct rotate_grab, base.grab);
@@ -4820,7 +4822,7 @@ rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
struct shell_surface *shsurf = rotate->base.shsurf;
float cx, cy, dx, dy, cposx, cposy, dposx, dposy, r;
- weston_pointer_move(pointer, x, y);
+ weston_pointer_move(pointer, event);
if (!shsurf)
return;