[gtk+/gtk-2-24] [quartz] Fix manual resizing of windows



commit 5f25687104f77aba310ac32c35d263f9d565d983
Author: Kristian Rietveld <kris lanedo com>
Date:   Sun Feb 19 16:08:26 2012 +0100

    [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.

 gdk/quartz/GdkQuartzWindow.c  |   10 ++++++++++
 gdk/quartz/GdkQuartzWindow.h  |    1 +
 gdk/quartz/gdkevents-quartz.c |    6 ++++++
 3 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gdk/quartz/GdkQuartzWindow.c b/gdk/quartz/GdkQuartzWindow.c
index df8f572..f7593ba 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 e6d1b4e..974e572 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 643ab9a..1927e72 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.
    */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]