[gtk/wip/chergert/quartz4u: 99/116] macos: add warp pointer helper



commit c4dceb54a9c63b6e8b3f8e4c9ca21125c190219f
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jun 18 12:35:35 2020 -0700

    macos: add warp pointer helper

 gdk/macos/gdkmacosdisplay-private.h |  3 +++
 gdk/macos/gdkmacosdisplay.c         | 12 ++++++++++++
 2 files changed, 15 insertions(+)
---
diff --git a/gdk/macos/gdkmacosdisplay-private.h b/gdk/macos/gdkmacosdisplay-private.h
index a29bea4ba2..9f3d55853b 100644
--- a/gdk/macos/gdkmacosdisplay-private.h
+++ b/gdk/macos/gdkmacosdisplay-private.h
@@ -145,6 +145,9 @@ void             _gdk_macos_display_clear_sorting                  (GdkMacosDisp
 const GList     *_gdk_macos_display_get_surfaces                   (GdkMacosDisplay *self);
 void             _gdk_macos_display_send_button_event              (GdkMacosDisplay *self,
                                                                     NSEvent         *nsevent);
+void             _gdk_macos_display_warp_pointer                   (GdkMacosDisplay *self,
+                                                                    int              x,
+                                                                    int              y);
 
 G_END_DECLS
 
diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c
index bd328075f0..043cea4edb 100644
--- a/gdk/macos/gdkmacosdisplay.c
+++ b/gdk/macos/gdkmacosdisplay.c
@@ -1045,3 +1045,15 @@ _gdk_macos_display_get_surfaces (GdkMacosDisplay *self)
 
   return self->sorted_surfaces.head;
 }
+
+void
+_gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
+                                 int              x,
+                                 int              y)
+{
+  g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
+
+  _gdk_macos_display_to_display_coords (self, x, y, &x, &y);
+
+  CGWarpMouseCursorPosition ((CGPoint) { x, y });
+}


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