This makes it consistent with the pointer grab, which also gets
global coordinates and not surface relative ones, and allows to
easily filter out gestures based on compositor global hotspots.
---
desktop-shell/shell.c | 14 ++++++++++----
src/data-device.c | 2 +-
src/input.c | 20 +++++++++++---------
3 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index fe620cb..8efc08b 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1563,7 +1563,7 @@ bind_workspace_manager(struct wl_client *client,
static void
touch_move_grab_down(struct weston_touch_grab *grab, uint32_t time,
- int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+ int touch_id, wl_fixed_t x, wl_fixed_t y)
{
}
@@ -1585,7 +1585,7 @@ touch_move_grab_up(struct weston_touch_grab *grab,
uint32_t time, int touch_id)
static void
touch_move_grab_motion(struct weston_touch_grab *grab, uint32_t time,
- int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+ int touch_id, wl_fixed_t x, wl_fixed_t y)
{
struct weston_touch_move_grab *move = (struct weston_touch_move_grab *)
grab;
struct shell_surface *shsurf = move->base.shsurf;
@@ -3240,7 +3240,7 @@ static const struct weston_pointer_grab_interface
popup_grab_interface = {
static void
touch_popup_grab_down(struct weston_touch_grab *grab, uint32_t time,
- int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+ int touch_id, wl_fixed_t x, wl_fixed_t y)
{
struct wl_resource *resource;
struct shell_seat *shseat =
@@ -3248,6 +3248,9 @@ touch_popup_grab_down(struct weston_touch_grab *grab,
uint32_t time,
struct wl_display *display = shseat->seat->compositor->wl_display;
uint32_t serial;
struct wl_list *resource_list;
+ wl_fixed_t sx, sy;
+
+ weston_view_from_global_fixed(grab->touch->focus, x, y, &sx, &sy);
resource_list = &grab->touch->focus_resource_list;
if (!wl_list_empty(resource_list)) {
@@ -3281,10 +3284,13 @@ touch_popup_grab_up(struct weston_touch_grab *grab,
uint32_t time, int touch_id)
static void
touch_popup_grab_motion(struct weston_touch_grab *grab, uint32_t time,
- int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+ int touch_id, wl_fixed_t x, wl_fixed_t y)
{
struct wl_resource *resource;
struct wl_list *resource_list;
+ wl_fixed_t sx, sy;
+
+ weston_view_from_global_fixed(grab->touch->focus, x, y, &sx, &sy);
resource_list = &grab->touch->focus_resource_list;
if (!wl_list_empty(resource_list)) {
diff --git a/src/data-device.c b/src/data-device.c
index 3e7baf9..e3bd3c3 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -476,7 +476,7 @@ drag_grab_touch_focus(struct weston_touch_drag *drag)
static void
drag_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time,
- int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+ int touch_id, wl_fixed_t x, wl_fixed_t y)
{
struct weston_touch_drag *touch_drag =
container_of(grab, struct weston_touch_drag, grab);
diff --git a/src/input.c b/src/input.c
index f6b1d29..c9850a6 100644
--- a/src/input.c
+++ b/src/input.c
@@ -232,13 +232,16 @@ static const struct weston_pointer_grab_interface
static void
default_grab_touch_down(struct weston_touch_grab *grab, uint32_t time,
- int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+ int touch_id, wl_fixed_t x, wl_fixed_t y)
{
struct weston_touch *touch = grab->touch;
struct wl_display *display = touch->seat->compositor->wl_display;
uint32_t serial;
struct wl_resource *resource;
struct wl_list *resource_list;
+ wl_fixed_t sx, sy;
+
+ weston_view_from_global_fixed(touch->focus, x, y, &sx, &sy);
resource_list = &touch->focus_resource_list;
@@ -272,11 +275,14 @@ default_grab_touch_up(struct weston_touch_grab *grab,
static void
default_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time,
- int touch_id, wl_fixed_t sx, wl_fixed_t sy)
+ int touch_id, wl_fixed_t x, wl_fixed_t y)
{
struct weston_touch *touch = grab->touch;
struct wl_resource *resource;
struct wl_list *resource_list;
+ wl_fixed_t sx, sy;
+
+ weston_view_from_global_fixed(touch->focus, x, y, &sx, &sy);
resource_list = &touch->focus_resource_list;
@@ -1552,10 +1558,7 @@ notify_touch(struct weston_seat *seat, uint32_t time,
int touch_id,
if (touch->num_tp == 1) {
ev = weston_compositor_pick_view(ec, x, y, &sx, &sy);
weston_touch_set_focus(touch, ev);
- } else if (touch->focus) {
- ev = touch->focus;
- weston_view_from_global_fixed(ev, x, y, &sx, &sy);
- } else {
+ } else if (!touch->focus) {
/* Unexpected condition: We have non-initial touch but
* there is no focused surface.
*/
@@ -1567,7 +1570,7 @@ notify_touch(struct weston_seat *seat, uint32_t time, int
touch_id,
weston_compositor_run_touch_binding(ec, seat,
time, touch_type);
- grab->interface->down(grab, time, touch_id, sx, sy);
+ grab->interface->down(grab, time, touch_id, x, y);
if (touch->num_tp == 1) {
touch->grab_serial =
wl_display_get_serial(ec->wl_display);
@@ -1583,8 +1586,7 @@ notify_touch(struct weston_seat *seat, uint32_t time, int
touch_id,
if (!ev)
break;
- weston_view_from_global_fixed(ev, x, y, &sx, &sy);
- grab->interface->motion(grab, time, touch_id, sx, sy);
+ grab->interface->motion(grab, time, touch_id, x, y);
break;
case WL_TOUCH_UP:
if (touch->num_tp == 0) {
--
2.4.5
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel