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.
This commit is contained in:
Christian Hergert 2009-09-25 21:52:13 +02:00 committed by Kristian Rietveld
parent 785e55f87d
commit 17130a8ec9

View File

@ -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;
}