diff options
author | Kristian Rietveld <kris@lanedo.com> | 2012-05-13 17:57:59 +0200 |
---|---|---|
committer | Kristian Rietveld <kris@lanedo.com> | 2012-05-13 18:00:47 +0200 |
commit | 194d5544b4bc4499e6953fb57010bb6b6db5f60a (patch) | |
tree | fc0a7d06550ce8b1932b22e5113105dfbd81753f | |
parent | 71164e57b9b999f07a613806058ee87b9cbf882d (diff) | |
download | gtk+-194d5544b4bc4499e6953fb57010bb6b6db5f60a.tar.gz |
quartz: Ignore events from all mouse buttons past the resize boundary
Before, right click events were still let through into GDK. In this
case, also middle/right button events with x-coordinates in the range
[-3, 0] are processed, resulting in failures/crashes in the window
finding code because no GdkWindows are present in this range.
-rw-r--r-- | gdk/quartz/gdkevents-quartz.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c index 1927e728bd..9478c16849 100644 --- a/gdk/quartz/gdkevents-quartz.c +++ b/gdk/quartz/gdkevents-quartz.c @@ -1119,15 +1119,13 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y) GdkWindowImplQuartz *toplevel_impl; gboolean lion; - /* Resizing only begins if an NSLeftMouseButton event is received in - * the resizing area. Handle anything else. + /* Resizing from the resize indicator only begins if an NSLeftMouseButton + * event is received in the resizing area. */ - if ([event type] != NSLeftMouseDown) - return FALSE; - toplevel_private = (GdkWindowObject *)toplevel; toplevel_impl = (GdkWindowImplQuartz *)toplevel_private->impl; - if ([toplevel_impl->toplevel showsResizeIndicator]) + if ([event type] == NSLeftMouseDown && + [toplevel_impl->toplevel showsResizeIndicator]) { NSRect frame; @@ -1155,12 +1153,25 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y) * the selector isRestorable to see if we're on 10.7. * This extra check is in case the user starts * dragging before GDK recognizes the grab. + * + * We perform this check for a button press of all buttons, because we + * do receive, for instance, a right mouse down event for a GDK window + * for x-coordinate range [-3, 0], but we do not want to forward this + * into GDK. Forwarding such events into GDK will confuse the pointer + * window finding code, because there are no GdkWindows present in + * the range [-3, 0]. */ lion = gdk_quartz_osx_version () >= GDK_OSX_LION; - if (lion && (x < GDK_LION_RESIZE || - x > toplevel_private->width - GDK_LION_RESIZE || - y > toplevel_private->height - GDK_LION_RESIZE)) - return TRUE; + if (lion && + ([event type] == NSLeftMouseDown || + [event type] == NSRightMouseDown || + [event type] == NSOtherMouseDown)) + { + if (x < GDK_LION_RESIZE || + x > toplevel_private->width - GDK_LION_RESIZE || + y > toplevel_private->height - GDK_LION_RESIZE) + return TRUE; + } return FALSE; } |