[mutter/wip/carlosg/cancel-pointer-gestures-on-unfocus: 3/4] wayland: Add pointer gesture cancellation internal API




commit e75f39624a938e4b8f85aeafdaeaf3828b3cb5f9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Sep 23 15:55:27 2022 +0200

    wayland: Add pointer gesture cancellation internal API
    
    This is ATM unused, but will be used to trigger cancellation of
    any active gesture.

 src/wayland/meta-wayland-pointer-gesture-hold.c  | 12 ++++++++++++
 src/wayland/meta-wayland-pointer-gesture-hold.h  |  3 +++
 src/wayland/meta-wayland-pointer-gesture-pinch.c | 12 ++++++++++++
 src/wayland/meta-wayland-pointer-gesture-pinch.h |  3 +++
 src/wayland/meta-wayland-pointer-gesture-swipe.c | 12 ++++++++++++
 src/wayland/meta-wayland-pointer-gesture-swipe.h |  3 +++
 6 files changed, 45 insertions(+)
---
diff --git a/src/wayland/meta-wayland-pointer-gesture-hold.c b/src/wayland/meta-wayland-pointer-gesture-hold.c
index 2bda793536..c4b3d187a2 100644
--- a/src/wayland/meta-wayland-pointer-gesture-hold.c
+++ b/src/wayland/meta-wayland-pointer-gesture-hold.c
@@ -23,6 +23,7 @@
 
 #include <glib.h>
 
+#include "core/display-private.h"
 #include "wayland/meta-wayland-pointer.h"
 #include "wayland/meta-wayland-seat.h"
 #include "wayland/meta-wayland-surface.h"
@@ -149,3 +150,14 @@ meta_wayland_pointer_gesture_hold_create_new_resource (MetaWaylandPointer *point
   wl_list_insert (&pointer_client->hold_gesture_resources,
                   wl_resource_get_link (res));
 }
+
+void
+meta_wayland_pointer_gesture_hold_cancel (MetaWaylandPointer *pointer,
+                                          uint32_t            serial)
+{
+  MetaDisplay *display = meta_get_display ();
+
+  broadcast_end (pointer, serial,
+                 meta_display_get_current_time (display),
+                 TRUE);
+}
diff --git a/src/wayland/meta-wayland-pointer-gesture-hold.h b/src/wayland/meta-wayland-pointer-gesture-hold.h
index 55846bff6f..f79c0b1099 100644
--- a/src/wayland/meta-wayland-pointer-gesture-hold.h
+++ b/src/wayland/meta-wayland-pointer-gesture-hold.h
@@ -34,4 +34,7 @@ void meta_wayland_pointer_gesture_hold_create_new_resource (MetaWaylandPointer *
                                                             struct wl_resource *gestures_resource,
                                                             uint32_t            id);
 
+void meta_wayland_pointer_gesture_hold_cancel (MetaWaylandPointer *pointer,
+                                               uint32_t            serial);
+
 #endif /* META_WAYLAND_POINTER_GESTURE_HOLD_H */
diff --git a/src/wayland/meta-wayland-pointer-gesture-pinch.c 
b/src/wayland/meta-wayland-pointer-gesture-pinch.c
index 01eb97c729..38511a53f6 100644
--- a/src/wayland/meta-wayland-pointer-gesture-pinch.c
+++ b/src/wayland/meta-wayland-pointer-gesture-pinch.c
@@ -27,6 +27,7 @@
 
 #include <glib.h>
 
+#include "core/display-private.h"
 #include "wayland/meta-wayland-pointer.h"
 #include "wayland/meta-wayland-seat.h"
 #include "wayland/meta-wayland-surface.h"
@@ -180,3 +181,14 @@ meta_wayland_pointer_gesture_pinch_create_new_resource (MetaWaylandPointer *poin
   wl_list_insert (&pointer_client->pinch_gesture_resources,
                   wl_resource_get_link (res));
 }
+
+void
+meta_wayland_pointer_gesture_pinch_cancel (MetaWaylandPointer *pointer,
+                                           uint32_t            serial)
+{
+  MetaDisplay *display = meta_get_display ();
+
+  broadcast_end (pointer, serial,
+                 meta_display_get_current_time (display),
+                 TRUE);
+}
diff --git a/src/wayland/meta-wayland-pointer-gesture-pinch.h 
b/src/wayland/meta-wayland-pointer-gesture-pinch.h
index 9ea3733f79..f5f1461aba 100644
--- a/src/wayland/meta-wayland-pointer-gesture-pinch.h
+++ b/src/wayland/meta-wayland-pointer-gesture-pinch.h
@@ -36,4 +36,7 @@ void meta_wayland_pointer_gesture_pinch_create_new_resource (MetaWaylandPointer
                                                              struct wl_resource *gestures_resource,
                                                              uint32_t            id);
 
+void meta_wayland_pointer_gesture_pinch_cancel (MetaWaylandPointer *pointer,
+                                                uint32_t            serial);
+
 #endif /* META_WAYLAND_POINTER_GESTURE_PINCH_H */
diff --git a/src/wayland/meta-wayland-pointer-gesture-swipe.c 
b/src/wayland/meta-wayland-pointer-gesture-swipe.c
index e3f65bfc30..7ac543a86a 100644
--- a/src/wayland/meta-wayland-pointer-gesture-swipe.c
+++ b/src/wayland/meta-wayland-pointer-gesture-swipe.c
@@ -27,6 +27,7 @@
 
 #include <glib.h>
 
+#include "core/display-private.h"
 #include "wayland/meta-wayland-pointer.h"
 #include "wayland/meta-wayland-seat.h"
 #include "wayland/meta-wayland-surface.h"
@@ -176,3 +177,14 @@ meta_wayland_pointer_gesture_swipe_create_new_resource (MetaWaylandPointer *poin
   wl_list_insert (&pointer_client->swipe_gesture_resources,
                   wl_resource_get_link (res));
 }
+
+void
+meta_wayland_pointer_gesture_swipe_cancel (MetaWaylandPointer *pointer,
+                                           uint32_t            serial)
+{
+  MetaDisplay *display = meta_get_display ();
+
+  broadcast_end (pointer, serial,
+                 meta_display_get_current_time (display),
+                 TRUE);
+}
diff --git a/src/wayland/meta-wayland-pointer-gesture-swipe.h 
b/src/wayland/meta-wayland-pointer-gesture-swipe.h
index ed53fc4b2d..7d7c679d6c 100644
--- a/src/wayland/meta-wayland-pointer-gesture-swipe.h
+++ b/src/wayland/meta-wayland-pointer-gesture-swipe.h
@@ -36,4 +36,7 @@ void meta_wayland_pointer_gesture_swipe_create_new_resource (MetaWaylandPointer
                                                              struct wl_resource *pointer_resource,
                                                              uint32_t            id);
 
+void meta_wayland_pointer_gesture_swipe_cancel (MetaWaylandPointer *pointer,
+                                                uint32_t            serial);
+
 #endif /* META_WAYLAND_POINTER_GESTURE_SWIPE_H */


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