[quartz] Fix manual resizing of windows

In the Quartz backend, there are two methods by which windows are
resized. The first method is fully handled by Quartz and does not appear
in the event stream the application resizes. The second method is when
we resize windows by ourselves. In OS X this happens when a GTK+ resize
grip is used. This resize grip is larger than the Quartz resize grip.
When the resize is started outside the "Quartz area", we have to handle
it by ourselves.

This patch fixes this manual window resizing by ignoring events while we
are in the process of resizing (such that the events actually arrive at
the sendEvent handler of GdkQuartzWindow where this resize is handled).
When the resize has finished we break all grabs such that GDK is not
stuck thinking the cursor is still in the resize window.
This commit is contained in:
Kristian Rietveld 2012-02-19 16:08:26 +01:00
parent ac4f3be6a5
commit 5f25687104
3 changed files with 17 additions and 0 deletions

View File

@ -115,10 +115,15 @@
switch ([event type])
{
case NSLeftMouseUp:
{
double time = ((double)[event timestamp]) * 1000.0;
_gdk_quartz_events_break_all_grabs (time);
inManualMove = NO;
inManualResize = NO;
inMove = NO;
break;
}
case NSLeftMouseDragged:
if ([self trackManualMove] || [self trackManualResize])
@ -383,6 +388,11 @@
return YES;
}
-(BOOL)isInManualResize
{
return inManualResize;
}
-(void)beginManualResize
{
if (inMove || inManualMove || inManualResize)

View File

@ -38,6 +38,7 @@
-(BOOL)isInMove;
-(void)beginManualMove;
-(BOOL)trackManualMove;
-(BOOL)isInManualResize;
-(void)beginManualResize;
-(BOOL)trackManualResize;
-(void)showAndMakeKey:(BOOL)makeKey;

View File

@ -1246,6 +1246,12 @@ gdk_event_translate (GdkEvent *event,
return FALSE;
}
/* Also when in a manual resize, we ignore events so that these are
* pushed to GdkQuartzWindow's sendEvent handler.
*/
if ([(GdkQuartzWindow *)nswindow isInManualResize])
return FALSE;
/* Find the right GDK window to send the event to, taking grabs and
* event masks into consideration.
*/