From b462bc35c0ebae01895e228d96396da03ceae441 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 14 Oct 2020 15:42:45 -0700 Subject: [PATCH] macos: allow pointer release event outside surface coords This helps with grab situations so that we can end it when releasing the pointer buttons outside of the window coordinates. --- gdk/macos/gdkmacosdisplay-translate.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gdk/macos/gdkmacosdisplay-translate.c b/gdk/macos/gdkmacosdisplay-translate.c index 41b738f99d..5ed44d3592 100644 --- a/gdk/macos/gdkmacosdisplay-translate.c +++ b/gdk/macos/gdkmacosdisplay-translate.c @@ -209,11 +209,6 @@ fill_button_event (GdkMacosDisplay *display, g_assert (GDK_IS_MACOS_DISPLAY (display)); g_assert (GDK_IS_MACOS_SURFACE (surface)); - /* Ignore button events outside the window coords */ - if (x < 0 || x > GDK_SURFACE (surface)->width || - y < 0 || y > GDK_SURFACE (surface)->height) - return NULL; - seat = gdk_display_get_default_seat (GDK_DISPLAY (display)); state = get_keyboard_modifiers_from_ns_event (nsevent) | _gdk_macos_display_get_current_mouse_modifiers (display); @@ -238,6 +233,14 @@ fill_button_event (GdkMacosDisplay *display, g_assert_not_reached (); } + /* Ignore button press events outside the window coords but + * allow for button release which can happen during grabs. + */ + if (type == GDK_BUTTON_PRESS && + (x < 0 || x > GDK_SURFACE (surface)->width || + y < 0 || y > GDK_SURFACE (surface)->height)) + return NULL; + return gdk_button_event_new (type, GDK_SURFACE (surface), gdk_seat_get_pointer (seat),