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.
This commit is contained in:
Christian Hergert
2020-10-14 15:42:45 -07:00
parent d700cfa2ef
commit b462bc35c0

View File

@@ -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),