OSX/Cocoa : discard Cocoa GL view flush while in live resize, and send Window size...
authorDamien Plisson <damien.plisson@yahoo.fr>
Sun, 26 Sep 2010 19:53:45 +0000 (19:53 +0000)
committerDamien Plisson <damien.plisson@yahoo.fr>
Sun, 26 Sep 2010 19:53:45 +0000 (19:53 +0000)
Potentially fixing bug [#23561]

intern/ghost/intern/GHOST_SystemCocoa.mm
intern/ghost/intern/GHOST_WindowCocoa.mm

index b7038a30e0086bdb83f327b8685063c043f6c10a..c998539fea1a22654329139363af391aa525b606 100644 (file)
@@ -987,6 +987,8 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
                return true;
        }
        
+       m_ignoreWindowSizedMessages = false;
+       
     return anyProcessed;
 }
 
@@ -1054,8 +1056,10 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
                        case GHOST_kEventWindowSize:
                                if (!m_ignoreWindowSizedMessages)
                                {
+                                       //Enforce only one resize message per event loop (coalescing all the live resize messages)                                      
                                        window->updateDrawingContext();
                                        pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
+                                       m_ignoreWindowSizedMessages = true;
                                }
                                break;
                        default:
index 83f86840eb4b0b61f978ef69ac4e95478a9bc707..aed9bd07cdc01104e134fe5b14d3d3e36bcea43b 100644 (file)
@@ -280,6 +280,18 @@ extern "C" {
     return YES;
 }
 
+- (void) drawRect:(NSRect)rect
+{
+    if ([self inLiveResize])
+    {
+        //Don't redraw while in live resize
+    }
+    else
+    {
+        [super drawRect:rect];
+    }
+}
+
 @end