diff options
author | Christian Hergert <chris@dronelabs.com> | 2009-09-25 21:52:13 +0200 |
---|---|---|
committer | Kristian Rietveld <kris@gtk.org> | 2009-09-25 21:52:13 +0200 |
commit | 17130a8ec9f461b681cce41215f460307a20aaba (patch) | |
tree | e1f49dd22615768557b094b4ac660cc339622f6b /gdk/quartz | |
parent | 785e55f87ddd364f2686a3bc5ed324ec629d7ef3 (diff) | |
download | gtk+-17130a8ec9f461b681cce41215f460307a20aaba.tar.gz |
Bug 517394 - Native resize grip steals button release ...
Explicitly handle resizing by leaving all events in the lower right 15x15
corner to Cocoa, if the window shows a resizing indicator. Some
applications may have widgets allocated in this area. Generally, these
widgets are likely larger than 15x15 so they can still be hit. Often
scroll bars are found in this area and these can also be manipulated by
other means. Since this is the only way of resizing windows on Mac OS X,
it is too important to keep it broken.
Diffstat (limited to 'gdk/quartz')
-rw-r--r-- | gdk/quartz/gdkevents-quartz.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c index 5be38b4941..54baef7f52 100644 --- a/gdk/quartz/gdkevents-quartz.c +++ b/gdk/quartz/gdkevents-quartz.c @@ -33,6 +33,9 @@ #include "gdkkeysyms.h" #include "gdkprivate-quartz.h" +#define GRIP_WIDTH 15 +#define GRIP_HEIGHT 15 + /* This is the window corresponding to the key window */ static GdkWindow *current_keyboard_window; @@ -564,8 +567,6 @@ find_window_for_ns_event (NSEvent *nsevent, if (*y < 0) return NULL; - /* FIXME: Also need to leave resize events to cocoa somehow? */ - /* As for owner events, we need to use the toplevel under the * pointer, not the window from the NSEvent. */ @@ -574,7 +575,38 @@ find_window_for_ns_event (NSEvent *nsevent, &x_tmp, &y_tmp); if (toplevel_under_pointer) { + GdkWindowObject *toplevel_private; + GdkWindowImplQuartz *toplevel_impl; + toplevel = toplevel_under_pointer; + + toplevel_private = (GdkWindowObject *)toplevel; + toplevel_impl = (GdkWindowImplQuartz *)toplevel_private->impl; + + if ([toplevel_impl->toplevel showsResizeIndicator]) + { + NSRect frame; + + /* If the resize indicator is visible and the event + * is in the lower right 15x15 corner, we leave these + * events to Cocoa as to be handled as resize events. + * Applications may have widgets in this area. These + * will most likely be larger than 15x15 and for + * scroll bars there are also other means to move + * the scroll bar. Since the resize indicator is + * the only way of resizing windows on Mac OS, it + * is too important to not make functional. + */ + frame = [toplevel_impl->view bounds]; + if (x_tmp > frame.size.width - GRIP_WIDTH + && x_tmp < frame.size.width + && y_tmp > frame.size.height - GRIP_HEIGHT + && y_tmp < frame.size.height) + { + return NULL; + } + } + *x = x_tmp; *y = y_tmp; } |