[mutter/wip/garnacho/touchpad-gestures: 2/2] wayland: Handle wl_gesture_pinch and wl_gesture_swipe interfaces



commit 22ed5b9e263946fcd8122424acde1afe994fbf11
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 9 17:07:38 2015 +0200

    wayland: Handle wl_gesture_pinch and wl_gesture_swipe interfaces
    
    Both of those depend on the MetaWaylandPointer, which forwards the
    respective gesture events to each MetaWaylandGestureSwipe/Pinch object,
    these will forward the events through the right per-client resources.
    
    Both of those interfaces have the same begin/update/end(+cancelled)
    phases, which are quite straightforwardly translated from events.

 src/Makefile.am                          |    4 +
 src/wayland/meta-wayland-gesture-pinch.c |  211 ++++++++++++++++++++++++++++++
 src/wayland/meta-wayland-gesture-pinch.h |   52 ++++++++
 src/wayland/meta-wayland-gesture-swipe.c |  207 +++++++++++++++++++++++++++++
 src/wayland/meta-wayland-gesture-swipe.h |   53 ++++++++
 src/wayland/meta-wayland-pointer.c       |   40 ++++++
 src/wayland/meta-wayland-pointer.h       |    5 +
 src/wayland/meta-wayland-seat.c          |    2 +
 src/wayland/meta-wayland-types.h         |    3 +
 src/wayland/meta-wayland-versions.h      |    2 +-
 10 files changed, 578 insertions(+), 1 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 0718c6b..5ef9666 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -250,6 +250,10 @@ libmutter_la_SOURCES +=                            \
        wayland/meta-wayland-data-device.c      \
        wayland/meta-wayland-data-device.h      \
        wayland/meta-wayland-data-device-private.h      \
+       wayland/meta-wayland-gesture-swipe.c    \
+       wayland/meta-wayland-gesture-swipe.h    \
+       wayland/meta-wayland-gesture-pinch.c    \
+       wayland/meta-wayland-gesture-pinch.h    \
        wayland/meta-wayland-keyboard.c         \
        wayland/meta-wayland-keyboard.h         \
        wayland/meta-wayland-pointer.c          \
diff --git a/src/wayland/meta-wayland-gesture-pinch.c b/src/wayland/meta-wayland-gesture-pinch.c
new file mode 100644
index 0000000..292634f
--- /dev/null
+++ b/src/wayland/meta-wayland-gesture-pinch.c
@@ -0,0 +1,211 @@
+/*
+ * Wayland Support
+ *
+ * Copyright (C) 2015 Red Hat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Author: Carlos Garnacho <carlosg gnome org>
+ */
+
+#define _GNU_SOURCE
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "meta-wayland-gesture-pinch.h"
+#include "meta-wayland-pointer.h"
+#include "meta-wayland-surface.h"
+
+static void
+unbind_resource (struct wl_resource *resource)
+{
+  wl_list_remove (wl_resource_get_link (resource));
+}
+
+static void
+move_resources (struct wl_list *destination, struct wl_list *source)
+{
+  wl_list_insert_list (destination, source);
+  wl_list_init (source);
+}
+
+static void
+move_resources_for_client (struct wl_list   *destination,
+                          struct wl_list   *source,
+                          struct wl_client *client)
+{
+  struct wl_resource *resource, *tmp;
+  wl_resource_for_each_safe (resource, tmp, source)
+    {
+      if (wl_resource_get_client (resource) == client)
+        {
+          wl_list_remove (wl_resource_get_link (resource));
+          wl_list_insert (destination, wl_resource_get_link (resource));
+        }
+    }
+}
+
+static void
+handle_pinch_begin (MetaWaylandGesturePinch *pinch,
+                    const ClutterEvent      *event)
+{
+  struct wl_resource *resource;
+  struct wl_list *l;
+  uint32_t serial;
+
+  l = &pinch->focus_resource_list;
+  serial = wl_display_next_serial (pinch->pointer->display);
+
+  wl_resource_for_each (resource, l)
+    {
+      wl_pointer_gesture_pinch_send_begin (resource, serial,
+                                           clutter_event_get_time (event), 2);
+    }
+}
+
+static void
+handle_pinch_update (MetaWaylandGesturePinch *pinch,
+                     const ClutterEvent      *event)
+{
+  struct wl_resource *resource;
+  gdouble dx, dy, scale, rotation;
+  struct wl_list *l;
+
+  l = &pinch->focus_resource_list;
+  clutter_event_get_gesture_motion_delta (event, &dx, &dy);
+  rotation = clutter_event_get_gesture_pinch_angle_delta (event);
+  scale = clutter_event_get_gesture_pinch_scale (event);
+
+  wl_resource_for_each (resource, l)
+    {
+      wl_pointer_gesture_pinch_send_update (resource,
+                                            clutter_event_get_time (event),
+                                            wl_fixed_from_double (dx),
+                                            wl_fixed_from_double (dy),
+                                            wl_fixed_from_double (scale),
+                                            wl_fixed_from_double (rotation));
+    }
+}
+
+static void
+handle_pinch_end (MetaWaylandGesturePinch *pinch,
+                  const ClutterEvent      *event)
+{
+  struct wl_resource *resource;
+  gboolean cancelled = FALSE;
+  struct wl_list *l;
+  uint32_t serial;
+
+  l = &pinch->focus_resource_list;
+  serial = wl_display_next_serial (pinch->pointer->display);
+
+  if (event->touchpad_pinch.phase == CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL)
+    cancelled = TRUE;
+
+  wl_resource_for_each (resource, l)
+    {
+      wl_pointer_gesture_pinch_send_end (resource, serial,
+                                         clutter_event_get_time (event),
+                                         cancelled);
+    }
+}
+
+gboolean
+meta_wayland_gesture_pinch_handle_event (MetaWaylandGesturePinch *pinch,
+                                         const ClutterEvent      *event)
+{
+  if (event->type != CLUTTER_TOUCHPAD_PINCH)
+    return FALSE;
+
+  switch (event->touchpad_pinch.phase)
+    {
+    case CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN:
+      handle_pinch_begin (pinch, event);
+      break;
+    case CLUTTER_TOUCHPAD_GESTURE_PHASE_UPDATE:
+      handle_pinch_update (pinch, event);
+      break;
+    case CLUTTER_TOUCHPAD_GESTURE_PHASE_END:
+    case CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL:
+      handle_pinch_end (pinch, event);
+      break;
+    default:
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+void
+meta_wayland_gesture_pinch_init (MetaWaylandGesturePinch *pinch,
+                                 MetaWaylandPointer      *pointer)
+{
+  pinch->pointer = pointer;
+  wl_list_init (&pinch->resource_list);
+  wl_list_init (&pinch->focus_resource_list);
+}
+
+void
+meta_wayland_gesture_pinch_release (MetaWaylandGesturePinch *pinch)
+{
+}
+
+static void
+pointer_gesture_pinch_release (struct wl_client   *client,
+                               struct wl_resource *resource)
+{
+  wl_resource_destroy (resource);
+}
+
+static const struct wl_pointer_gesture_pinch_interface pointer_gesture_pinch_interface = {
+  pointer_gesture_pinch_release
+};
+
+void
+meta_wayland_gesture_pinch_create_new_resource (MetaWaylandGesturePinch *pinch,
+                                                struct wl_client        *client,
+                                                struct wl_resource      *pointer_resource,
+                                                uint32_t                 id)
+{
+  MetaWaylandPointer *pointer = pinch->pointer;
+  struct wl_resource *res;
+  struct wl_list *l;
+
+  res = wl_resource_create (client, &wl_pointer_gesture_pinch_interface, wl_resource_get_version 
(pointer_resource), id);
+  wl_resource_set_implementation (res, &pointer_gesture_pinch_interface, pinch, unbind_resource);
+
+  if (pointer->focus_surface && wl_resource_get_client (pointer->focus_surface->resource) == client)
+    l = &pinch->focus_resource_list;
+  else
+    l = &pinch->resource_list;
+
+  wl_list_insert (l, wl_resource_get_link (res));
+}
+
+void
+meta_wayland_gesture_pinch_sync_focus (MetaWaylandGesturePinch *pinch)
+{
+  MetaWaylandPointer *pointer = pinch->pointer;
+
+  move_resources (&pinch->resource_list, &pinch->focus_resource_list);
+
+  if (pointer->focus_surface)
+    move_resources_for_client (&pinch->focus_resource_list,
+                               &pinch->resource_list,
+                               wl_resource_get_client (pointer->focus_surface->resource));
+}
diff --git a/src/wayland/meta-wayland-gesture-pinch.h b/src/wayland/meta-wayland-gesture-pinch.h
new file mode 100644
index 0000000..9c6c912
--- /dev/null
+++ b/src/wayland/meta-wayland-gesture-pinch.h
@@ -0,0 +1,52 @@
+/*
+ * Wayland Support
+ *
+ * Copyright (C) 2015 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Carlos Garnacho <carlosg gnome org>
+ */
+
+#ifndef META_WAYLAND_GESTURE_PINCH_H
+#define META_WAYLAND_GESTURE_PINCH_H
+
+#include <wayland-server.h>
+#include <clutter/clutter.h>
+#include <glib.h>
+
+#include "meta-wayland-types.h"
+
+struct _MetaWaylandGesturePinch
+{
+  MetaWaylandPointer *pointer;
+  struct wl_list resource_list;
+  struct wl_list focus_resource_list;
+};
+
+void meta_wayland_gesture_pinch_init    (MetaWaylandGesturePinch *pinch,
+                                         MetaWaylandPointer      *pointer);
+
+void meta_wayland_gesture_pinch_release (MetaWaylandGesturePinch *pinch);
+
+gboolean meta_wayland_gesture_pinch_handle_event (MetaWaylandGesturePinch *pinch,
+                                                  const ClutterEvent      *event);
+
+void meta_wayland_gesture_pinch_create_new_resource (MetaWaylandGesturePinch *pinch,
+                                                     struct wl_client        *client,
+                                                     struct wl_resource      *pointer_resource,
+                                                     uint32_t                 id);
+void meta_wayland_gesture_pinch_sync_focus (MetaWaylandGesturePinch *pinch);
+
+#endif /* META_WAYLAND_GESTURE_PINCH_H */
diff --git a/src/wayland/meta-wayland-gesture-swipe.c b/src/wayland/meta-wayland-gesture-swipe.c
new file mode 100644
index 0000000..bdf9b8e
--- /dev/null
+++ b/src/wayland/meta-wayland-gesture-swipe.c
@@ -0,0 +1,207 @@
+/*
+ * Wayland Support
+ *
+ * Copyright (C) 2015 Red Hat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Author: Carlos Garnacho <carlosg gnome org>
+ */
+
+#define _GNU_SOURCE
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "meta-wayland-gesture-swipe.h"
+#include "meta-wayland-pointer.h"
+#include "meta-wayland-surface.h"
+
+static void
+unbind_resource (struct wl_resource *resource)
+{
+  wl_list_remove (wl_resource_get_link (resource));
+}
+
+static void
+move_resources (struct wl_list *destination, struct wl_list *source)
+{
+  wl_list_insert_list (destination, source);
+  wl_list_init (source);
+}
+
+static void
+move_resources_for_client (struct wl_list   *destination,
+                          struct wl_list   *source,
+                          struct wl_client *client)
+{
+  struct wl_resource *resource, *tmp;
+  wl_resource_for_each_safe (resource, tmp, source)
+    {
+      if (wl_resource_get_client (resource) == client)
+        {
+          wl_list_remove (wl_resource_get_link (resource));
+          wl_list_insert (destination, wl_resource_get_link (resource));
+        }
+    }
+}
+
+static void
+handle_swipe_begin (MetaWaylandGestureSwipe *swipe,
+                    const ClutterEvent      *event)
+{
+  struct wl_resource *resource;
+  uint32_t serial, fingers;
+  struct wl_list *l;
+
+  l = &swipe->focus_resource_list;
+  serial = wl_display_next_serial (swipe->pointer->display);
+  fingers = clutter_event_get_gesture_swipe_finger_count (event);
+
+  wl_resource_for_each (resource, l)
+    {
+      wl_pointer_gesture_swipe_send_begin (resource, serial,
+                                           clutter_event_get_time (event), fingers);
+    }
+}
+
+static void
+handle_swipe_update (MetaWaylandGestureSwipe *swipe,
+                     const ClutterEvent      *event)
+{
+  struct wl_resource *resource;
+  struct wl_list *l;
+  gdouble dx, dy;
+
+  l = &swipe->focus_resource_list;
+  clutter_event_get_gesture_motion_delta (event, &dx, &dy);
+
+  wl_resource_for_each (resource, l)
+    {
+      wl_pointer_gesture_swipe_send_update (resource,
+                                            clutter_event_get_time (event),
+                                            wl_fixed_from_double (dx),
+                                            wl_fixed_from_double (dy));
+    }
+}
+
+static void
+handle_swipe_end (MetaWaylandGestureSwipe *swipe,
+                  const ClutterEvent      *event)
+{
+  struct wl_resource *resource;
+  gboolean cancelled = FALSE;
+  struct wl_list *l;
+  uint32_t serial;
+
+  l = &swipe->focus_resource_list;
+  serial = wl_display_next_serial (swipe->pointer->display);
+
+  if (event->touchpad_swipe.phase == CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL)
+    cancelled = TRUE;
+
+  wl_resource_for_each (resource, l)
+    {
+      wl_pointer_gesture_swipe_send_end (resource, serial,
+                                         clutter_event_get_time (event),
+                                         cancelled);
+    }
+}
+
+gboolean
+meta_wayland_gesture_swipe_handle_event (MetaWaylandGestureSwipe *swipe,
+                                         const ClutterEvent      *event)
+{
+  if (event->type != CLUTTER_TOUCHPAD_SWIPE)
+    return FALSE;
+
+  switch (event->touchpad_swipe.phase)
+    {
+    case CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN:
+      handle_swipe_begin (swipe, event);
+      break;
+    case CLUTTER_TOUCHPAD_GESTURE_PHASE_UPDATE:
+      handle_swipe_update (swipe, event);
+      break;
+    case CLUTTER_TOUCHPAD_GESTURE_PHASE_END:
+      handle_swipe_end (swipe, event);
+      break;
+    default:
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+void
+meta_wayland_gesture_swipe_init (MetaWaylandGestureSwipe *swipe,
+                                 MetaWaylandPointer      *pointer)
+{
+  swipe->pointer = pointer;
+  wl_list_init (&swipe->resource_list);
+  wl_list_init (&swipe->focus_resource_list);
+}
+
+void
+meta_wayland_gesture_swipe_release (MetaWaylandGestureSwipe *swipe)
+{
+}
+
+static void
+pointer_gesture_swipe_release (struct wl_client   *client,
+                       struct wl_resource *resource)
+{
+  wl_resource_destroy (resource);
+}
+
+static const struct wl_pointer_gesture_swipe_interface pointer_gesture_swipe_interface = {
+  pointer_gesture_swipe_release
+};
+
+void
+meta_wayland_gesture_swipe_create_new_resource (MetaWaylandGestureSwipe *swipe,
+                                                struct wl_client        *client,
+                                                struct wl_resource      *pointer_resource,
+                                                uint32_t                 id)
+{
+  MetaWaylandPointer *pointer = swipe->pointer;
+  struct wl_resource *res;
+  struct wl_list *l;
+
+  res = wl_resource_create (client, &wl_pointer_gesture_swipe_interface, wl_resource_get_version 
(pointer_resource), id);
+  wl_resource_set_implementation (res, &pointer_gesture_swipe_interface, swipe, unbind_resource);
+
+  if (pointer->focus_surface && wl_resource_get_client (pointer->focus_surface->resource) == client)
+    l = &swipe->focus_resource_list;
+  else
+    l = &swipe->resource_list;
+
+  wl_list_insert (l, wl_resource_get_link (res));
+}
+
+void
+meta_wayland_gesture_swipe_sync_focus (MetaWaylandGestureSwipe *swipe)
+{
+  MetaWaylandPointer *pointer = swipe->pointer;
+
+  move_resources (&swipe->resource_list, &swipe->focus_resource_list);
+
+  if (pointer->focus_surface)
+    move_resources_for_client (&swipe->focus_resource_list,
+                               &swipe->resource_list,
+                               wl_resource_get_client (pointer->focus_surface->resource));
+}
diff --git a/src/wayland/meta-wayland-gesture-swipe.h b/src/wayland/meta-wayland-gesture-swipe.h
new file mode 100644
index 0000000..28986a7
--- /dev/null
+++ b/src/wayland/meta-wayland-gesture-swipe.h
@@ -0,0 +1,53 @@
+/*
+ * Wayland Support
+ *
+ * Copyright (C) 2015 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Carlos Garnacho <carlosg gnome org>
+ */
+
+#ifndef META_WAYLAND_GESTURE_SWIPE_H
+#define META_WAYLAND_GESTURE_SWIPE_H
+
+#include <wayland-server.h>
+#include <clutter/clutter.h>
+#include <glib.h>
+
+#include "meta-wayland-types.h"
+
+struct _MetaWaylandGestureSwipe
+{
+  MetaWaylandPointer *pointer;
+  struct wl_list resource_list;
+  struct wl_list focus_resource_list;
+};
+
+void meta_wayland_gesture_swipe_init    (MetaWaylandGestureSwipe *swipe,
+                                         MetaWaylandPointer      *pointer);
+
+void meta_wayland_gesture_swipe_release (MetaWaylandGestureSwipe *swipe);
+
+gboolean meta_wayland_gesture_swipe_handle_event (MetaWaylandGestureSwipe *swipe,
+                                                  const ClutterEvent      *event);
+
+void meta_wayland_gesture_swipe_create_new_resource (MetaWaylandGestureSwipe *swipe,
+                                                     struct wl_client        *client,
+                                                     struct wl_resource      *pointer_resource,
+                                                     uint32_t                 id);
+
+void meta_wayland_gesture_swipe_sync_focus (MetaWaylandGestureSwipe *swipe);
+
+#endif /* META_WAYLAND_GESTURE_SWIPE_H */
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index a229fe2..2d5b481 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -257,11 +257,17 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer,
   pointer->device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE);
 
   pointer->cursor_tracker = meta_cursor_tracker_get_for_screen (NULL);
+
+  meta_wayland_gesture_swipe_init (&pointer->swipe, pointer);
+  meta_wayland_gesture_pinch_init (&pointer->pinch, pointer);
 }
 
 void
 meta_wayland_pointer_release (MetaWaylandPointer *pointer)
 {
+  meta_wayland_gesture_swipe_release (&pointer->swipe);
+  meta_wayland_gesture_pinch_release (&pointer->pinch);
+
   meta_wayland_pointer_set_focus (pointer, NULL);
   set_cursor_surface (pointer, NULL);
 
@@ -430,6 +436,14 @@ meta_wayland_pointer_handle_event (MetaWaylandPointer *pointer,
       handle_scroll_event (pointer, event);
       break;
 
+    case CLUTTER_TOUCHPAD_SWIPE:
+      meta_wayland_gesture_swipe_handle_event (&pointer->swipe, event);
+      break;
+
+    case CLUTTER_TOUCHPAD_PINCH:
+      meta_wayland_gesture_pinch_handle_event (&pointer->pinch, event);
+      break;
+
     default:
       break;
     }
@@ -540,6 +554,8 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
     }
 
   meta_wayland_pointer_update_cursor_surface (pointer);
+  meta_wayland_gesture_swipe_sync_focus (&pointer->swipe);
+  meta_wayland_gesture_pinch_sync_focus (&pointer->pinch);
 }
 
 void
@@ -695,9 +711,33 @@ pointer_release (struct wl_client *client,
   wl_resource_destroy (resource);
 }
 
+static void
+pointer_get_swipe_gesture (struct wl_client   *client,
+                           struct wl_resource *resource,
+                           uint32_t            id)
+{
+  MetaWaylandPointer *pointer = wl_resource_get_user_data (resource);
+  MetaWaylandGestureSwipe *swipe = &pointer->swipe;
+
+  meta_wayland_gesture_swipe_create_new_resource (swipe, client, resource, id);
+}
+
+static void
+pointer_get_pinch_gesture (struct wl_client   *client,
+                           struct wl_resource *resource,
+                           uint32_t            id)
+{
+  MetaWaylandPointer *pointer = wl_resource_get_user_data (resource);
+  MetaWaylandGesturePinch *pinch = &pointer->pinch;
+
+  meta_wayland_gesture_pinch_create_new_resource (pinch, client, resource, id);
+}
+
 static const struct wl_pointer_interface pointer_interface = {
   pointer_set_cursor,
   pointer_release,
+  pointer_get_swipe_gesture,
+  pointer_get_pinch_gesture
 };
 
 void
diff --git a/src/wayland/meta-wayland-pointer.h b/src/wayland/meta-wayland-pointer.h
index 70b7b42..710e061 100644
--- a/src/wayland/meta-wayland-pointer.h
+++ b/src/wayland/meta-wayland-pointer.h
@@ -24,6 +24,8 @@
 
 #include <glib.h>
 
+#include "meta-wayland-gesture-swipe.h"
+#include "meta-wayland-gesture-pinch.h"
 #include "meta-wayland-types.h"
 
 #include <meta/meta-cursor-tracker.h>
@@ -51,6 +53,9 @@ struct _MetaWaylandPointer
   struct wl_list resource_list;
   struct wl_list focus_resource_list;
 
+  MetaWaylandGestureSwipe swipe;
+  MetaWaylandGesturePinch pinch;
+
   MetaWaylandSurface *focus_surface;
   struct wl_listener focus_surface_listener;
   guint32 focus_serial;
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index f455ad8..58f2697 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -332,6 +332,8 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
     case CLUTTER_BUTTON_PRESS:
     case CLUTTER_BUTTON_RELEASE:
     case CLUTTER_SCROLL:
+    case CLUTTER_TOUCHPAD_SWIPE:
+    case CLUTTER_TOUCHPAD_PINCH:
       return meta_wayland_pointer_handle_event (&seat->pointer, event);
 
     case CLUTTER_KEY_PRESS:
diff --git a/src/wayland/meta-wayland-types.h b/src/wayland/meta-wayland-types.h
index 637af77..883b926 100644
--- a/src/wayland/meta-wayland-types.h
+++ b/src/wayland/meta-wayland-types.h
@@ -41,4 +41,7 @@ typedef struct _MetaWaylandSurface MetaWaylandSurface;
 
 typedef struct _MetaWaylandSerial MetaWaylandSerial;
 
+typedef struct _MetaWaylandGestureSwipe MetaWaylandGestureSwipe;
+typedef struct _MetaWaylandGesturePinch MetaWaylandGesturePinch;
+
 #endif
diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h
index 08ceaca..c91978d 100644
--- a/src/wayland/meta-wayland-versions.h
+++ b/src/wayland/meta-wayland-versions.h
@@ -39,7 +39,7 @@
 #define META_WL_DATA_DEVICE_MANAGER_VERSION 2
 #define META_XDG_SHELL_VERSION              1
 #define META_WL_SHELL_VERSION               1
-#define META_WL_SEAT_VERSION                4
+#define META_WL_SEAT_VERSION                5
 #define META_WL_OUTPUT_VERSION              2
 #define META_XSERVER_VERSION                1
 #define META_GTK_SHELL_VERSION              2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]