X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/85a74f93bf8deeb24caea31a6435eede98143f9c..ab67e8874db324fab5223cc8d5dff8a8de3e2b77:/src/osx/cocoa/evtloop.mm diff --git a/src/osx/cocoa/evtloop.mm b/src/osx/cocoa/evtloop.mm index 759c02b1ca..135f936de5 100644 --- a/src/osx/cocoa/evtloop.mm +++ b/src/osx/cocoa/evtloop.mm @@ -109,6 +109,7 @@ wxGUIEventLoop::wxGUIEventLoop() m_dummyWindow = nil; m_modalNestedLevel = 0; m_modalWindow = NULL; + m_osxLowLevelWakeUp = false; } wxGUIEventLoop::~wxGUIEventLoop() @@ -143,6 +144,7 @@ bool wxGUIEventLoop::Pending() const #endif } + bool wxGUIEventLoop::Dispatch() { if ( !wxTheApp ) @@ -254,14 +256,28 @@ void wxGUIEventLoop::DoStop() void wxGUIEventLoop::WakeUp() { - NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined + // NSEvent* cevent = [NSApp currentEvent]; + // NSString* mode = [[NSRunLoop mainRunLoop] currentMode]; + + // when already in a mouse event handler, don't add higher level event + // if ( cevent != nil && [cevent type] <= NSMouseMoved && ) + if ( m_osxLowLevelWakeUp /* [NSEventTrackingRunLoopMode isEqualToString:mode] */ ) + { + // NSLog(@"event for wakeup %@ in mode %@",cevent,mode); + wxCFEventLoop::WakeUp(); + } + else + { + wxMacAutoreleasePool autoreleasepool; + NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined location:NSMakePoint(0.0, 0.0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil subtype:0 data1:0 data2:0]; - [NSApp postEvent:event atStart:FALSE]; + [NSApp postEvent:event atStart:FALSE]; + } } CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const @@ -310,7 +326,7 @@ void wxModalEventLoop::DoRun() void wxModalEventLoop::DoStop() { - [NSApp stopModal]; + [NSApp abortModal]; } void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow ) @@ -420,7 +436,8 @@ void wxWindowDisabler::DoDisable(wxWindow *winToSkip) } m_modalEventLoop = (wxEventLoop*)wxEventLoopBase::GetActive(); - m_modalEventLoop->BeginModalSession(winToSkip); + if (m_modalEventLoop) + m_modalEventLoop->BeginModalSession(winToSkip); } wxWindowDisabler::~wxWindowDisabler() @@ -428,7 +445,8 @@ wxWindowDisabler::~wxWindowDisabler() if ( !m_disabled ) return; - m_modalEventLoop->EndModalSession(); + if (m_modalEventLoop) + m_modalEventLoop->EndModalSession(); wxWindowList::compatibility_iterator node; for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() ) @@ -442,5 +460,4 @@ wxWindowDisabler::~wxWindowDisabler() } delete m_winDisabled; -} - +} \ No newline at end of file