diff options
author | Maarten Gribnau <mail@maartengribnau.com> | 2003-01-02 00:31:36 +0300 |
---|---|---|
committer | Maarten Gribnau <mail@maartengribnau.com> | 2003-01-02 00:31:36 +0300 |
commit | 581b3139b1e34b4351b4cd13540057a5c86fcb7f (patch) | |
tree | 00e72908a398813051e5ae12e2d5a720ecef847e /intern | |
parent | 490b6469f2dd6b03b5840822975276daaf48a4e0 (diff) |
Fix for lots of window size events during window drag
Maarten
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCarbon.cpp | 16 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCarbon.h | 3 |
2 files changed, 17 insertions, 2 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index 1b44a83d3fa..de576076234 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -195,6 +195,7 @@ GHOST_SystemCarbon::GHOST_SystemCarbon() : UnsignedWide micros; ::Microseconds(µs); m_start_time = UnsignedWideToUInt64(micros)/1000; + m_ignoreWindowSizedMessages = false; } GHOST_SystemCarbon::~GHOST_SystemCarbon() @@ -501,8 +502,11 @@ OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event) pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) ); break; case kEventWindowBoundsChanged: - window->updateDrawingContext(); - pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) ); + if (!m_ignoreWindowSizedMessages) + { + window->updateDrawingContext(); + pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) ); + } break; } } @@ -636,7 +640,15 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event) break; case inDrag: + /* + * The DragWindow() routine creates a lot of kEventWindowBoundsChanged + * events. By setting m_ignoreWindowSizedMessages these are suppressed. + * @see GHOST_SystemCarbon::handleWindowEvent(EventRef event) + */ + GHOST_ASSERT(validWindow(ghostWindow), "GHOST_SystemCarbon::handleMouseDown: invalid window"); + m_ignoreWindowSizedMessages = true; ::DragWindow(window, mousePos, &GetQDGlobalsScreenBits(&screenBits)->bounds); + m_ignoreWindowSizedMessages = false; break; case inContent: diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h index ec1ff338c8f..a08a070a7b2 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.h +++ b/intern/ghost/intern/GHOST_SystemCarbon.h @@ -241,6 +241,9 @@ protected: /** State of the modifiers. */ UInt32 m_modifierMask; + + /** Ignores window size messages (when window is dragged). */ + bool m_ignoreWindowSizedMessages; }; #endif // _GHOST_SYSTEM_CARBON_H_ |