summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <christian@hergert.me>2022-03-09 13:19:22 -0800
committerChristian Hergert <chergert@redhat.com>2022-03-16 12:25:10 -0700
commit913f6d4a4fc63f2ba19c00b8db6d9c3ab268adc9 (patch)
tree5364789575a97cbaad08ce88d98b35c711bec665
parentcb386ec2a26de106822c24fd3cc9a276c978d9ad (diff)
downloadgtk+-913f6d4a4fc63f2ba19c00b8db6d9c3ab268adc9.tar.gz
macos: allow dropping NSEvent without propagation
There are cases we might want to consume a NSEvent without creating a GdkEvent or passing it along to the NSApplication for processing. This creates a new value we can use and check against to propagate that without having to do out parameters at the slightly odd invalid pointer value for a GdkEvent (similar to how MMAP_FAILED is done).
-rw-r--r--gdk/macos/gdkmacosdisplay-private.h2
-rw-r--r--gdk/macos/gdkmacosdisplay.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/gdk/macos/gdkmacosdisplay-private.h b/gdk/macos/gdkmacosdisplay-private.h
index ef17618d61..72b5f5cd57 100644
--- a/gdk/macos/gdkmacosdisplay-private.h
+++ b/gdk/macos/gdkmacosdisplay-private.h
@@ -43,6 +43,8 @@ G_BEGIN_DECLS
#define GIC_FILTER_PASSTHRU 0
#define GIC_FILTER_FILTERED 1
+#define GDK_MACOS_EVENT_DROP (GdkEvent *)GSIZE_TO_POINTER(1)
+
struct _GdkMacosDisplay
{
GdkDisplay parent_instance;
diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c
index bc58c2a6f3..9fbfac49ed 100644
--- a/gdk/macos/gdkmacosdisplay.c
+++ b/gdk/macos/gdkmacosdisplay.c
@@ -314,7 +314,11 @@ gdk_macos_display_queue_events (GdkDisplay *display)
{
GdkEvent *event = _gdk_macos_display_translate (self, nsevent);
- if (event != NULL)
+ if (event == GDK_MACOS_EVENT_DROP)
+ {
+ [nsevent release];
+ }
+ else if (event != NULL)
{
push_nsevent (event, nsevent);
_gdk_windowing_got_event (GDK_DISPLAY (self),