Fix for lots of window size events during window drag

Maarten
This commit is contained in:
Maarten Gribnau 2003-01-01 21:31:36 +00:00
parent 490b6469f2
commit 581b3139b1
2 changed files with 17 additions and 2 deletions

@ -195,6 +195,7 @@ GHOST_SystemCarbon::GHOST_SystemCarbon() :
UnsignedWide micros; UnsignedWide micros;
::Microseconds(&micros); ::Microseconds(&micros);
m_start_time = UnsignedWideToUInt64(micros)/1000; m_start_time = UnsignedWideToUInt64(micros)/1000;
m_ignoreWindowSizedMessages = false;
} }
GHOST_SystemCarbon::~GHOST_SystemCarbon() GHOST_SystemCarbon::~GHOST_SystemCarbon()
@ -501,8 +502,11 @@ OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) ); pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
break; break;
case kEventWindowBoundsChanged: case kEventWindowBoundsChanged:
if (!m_ignoreWindowSizedMessages)
{
window->updateDrawingContext(); window->updateDrawingContext();
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) ); pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
}
break; break;
} }
} }
@ -636,7 +640,15 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
break; break;
case inDrag: 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); ::DragWindow(window, mousePos, &GetQDGlobalsScreenBits(&screenBits)->bounds);
m_ignoreWindowSizedMessages = false;
break; break;
case inContent: case inContent:

@ -241,6 +241,9 @@ protected:
/** State of the modifiers. */ /** State of the modifiers. */
UInt32 m_modifierMask; UInt32 m_modifierMask;
/** Ignores window size messages (when window is dragged). */
bool m_ignoreWindowSizedMessages;
}; };
#endif // _GHOST_SYSTEM_CARBON_H_ #endif // _GHOST_SYSTEM_CARBON_H_