summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Rietveld <kris@lanedo.com>2012-02-19 16:08:26 +0100
committerKristian Rietveld <kris@lanedo.com>2012-04-10 21:22:07 +0200
commit5f25687104f77aba310ac32c35d263f9d565d983 (patch)
tree581e4b657f5dd00e3a8ea193f193ba4139bf8ab6
parentac4f3be6a5a6672708af8fe732b932fd1e1d8beb (diff)
downloadgtk+-5f25687104f77aba310ac32c35d263f9d565d983.tar.gz
[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.
-rw-r--r--gdk/quartz/GdkQuartzWindow.c10
-rw-r--r--gdk/quartz/GdkQuartzWindow.h1
-rw-r--r--gdk/quartz/gdkevents-quartz.c6
3 files changed, 17 insertions, 0 deletions
diff --git a/gdk/quartz/GdkQuartzWindow.c b/gdk/quartz/GdkQuartzWindow.c
index df8f5722a9..f7593baaa3 100644
--- a/gdk/quartz/GdkQuartzWindow.c
+++ b/gdk/quartz/GdkQuartzWindow.c
@@ -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)
diff --git a/gdk/quartz/GdkQuartzWindow.h b/gdk/quartz/GdkQuartzWindow.h
index e6d1b4e155..974e57253f 100644
--- a/gdk/quartz/GdkQuartzWindow.h
+++ b/gdk/quartz/GdkQuartzWindow.h
@@ -38,6 +38,7 @@
-(BOOL)isInMove;
-(void)beginManualMove;
-(BOOL)trackManualMove;
+-(BOOL)isInManualResize;
-(void)beginManualResize;
-(BOOL)trackManualResize;
-(void)showAndMakeKey:(BOOL)makeKey;
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index 643ab9ae2d..1927e728bd 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -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.
*/