X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f965a844db8663b80c42afcbb6ae2dc36fd77ac3..030495ecf11a16c27e711f0d812226d6b940d42b:/src/osx/cocoa/evtloop.mm diff --git a/src/osx/cocoa/evtloop.mm b/src/osx/cocoa/evtloop.mm index 92f08d178e..4798214f02 100644 --- a/src/osx/cocoa/evtloop.mm +++ b/src/osx/cocoa/evtloop.mm @@ -38,6 +38,43 @@ // wxEventLoop implementation // ============================================================================ +/* +static int CalculateNSEventMaskFromEventCategory(wxEventCategory cat) +{ + NSLeftMouseDownMask | + NSLeftMouseUpMask | + NSRightMouseDownMask | + NSRightMouseUpMask = 1 << NSRightMouseUp, + NSMouseMovedMask = 1 << NSMouseMoved, + NSLeftMouseDraggedMask = 1 << NSLeftMouseDragged, + NSRightMouseDraggedMask = 1 << NSRightMouseDragged, + NSMouseEnteredMask = 1 << NSMouseEntered, + NSMouseExitedMask = 1 << NSMouseExited, + NSScrollWheelMask = 1 << NSScrollWheel, +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 + NSTabletPointMask = 1 << NSTabletPoint, + NSTabletProximityMask = 1 << NSTabletProximity, +#endif + NSOtherMouseDownMask = 1 << NSOtherMouseDown, + NSOtherMouseUpMask = 1 << NSOtherMouseUp, + NSOtherMouseDraggedMask = 1 << NSOtherMouseDragged, + + + + NSKeyDownMask = 1 << NSKeyDown, + NSKeyUpMask = 1 << NSKeyUp, + NSFlagsChangedMask = 1 << NSFlagsChanged, + + NSAppKitDefinedMask = 1 << NSAppKitDefined, + NSSystemDefinedMask = 1 << NSSystemDefined, + NSApplicationDefinedMask = 1 << NSApplicationDefined, + NSPeriodicMask = 1 << NSPeriodic, + NSCursorUpdateMask = 1 << NSCursorUpdate, + + NSAnyEventMask = 0xffffffffU +} +*/ + wxGUIEventLoop::wxGUIEventLoop() { m_sleepTime = 0.0; @@ -50,6 +87,16 @@ void wxGUIEventLoop::WakeUp() wxMacWakeUp(); } +CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const +{ + NSRunLoop* nsloop = [NSRunLoop currentRunLoop]; + return [nsloop getCFRunLoop]; +} + +//----------------------------------------------------------------------------- +// events dispatch and loop handling +//----------------------------------------------------------------------------- + bool wxGUIEventLoop::Pending() const { wxMacAutoreleasePool autoreleasepool; @@ -79,6 +126,9 @@ bool wxGUIEventLoop::Dispatch() } else { + if (wxTheApp) + wxTheApp->ProcessPendingEvents(); + if ( wxTheApp->ProcessIdle() ) m_sleepTime = 0.0 ; else @@ -124,6 +174,10 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess) // OnUpdateUI() which is a nice (and desired) side effect) while ( ProcessIdle() ) {} + // if there are pending events, we must process them. + if (wxTheApp) + wxTheApp->ProcessPendingEvents(); + #if wxUSE_LOG wxLog::Resume(); #endif // wxUSE_LOG