diff options
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 7aa365df67..80c9e227d2 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -510,14 +510,16 @@ static bool IsMouseOrKeyEvent( NSEvent* event ) static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRunLoopMode) { - // If no event exist in the cocoa event que, wait - // (and free up cpu time) until at least one event occur. - // This implementation is a bit on the edge, but seems to - // work fine: - [NSApp nextEventMatchingMask:NSAnyEventMask - untilDate:[NSDate distantFuture] - inMode:runLoopMode - dequeue:NO]; + // If no event exist in the cocoa event que, wait (and free up cpu time) until + // at least one event occur. Setting 'dequeuing' to 'no' in the following call + // causes it to hang under certain circumstances (QTBUG-28283), so we tell it + // to dequeue instead, just to repost the event again: + NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:[NSDate distantFuture] + inMode:runLoopMode + dequeue:YES]; + if (event) + [NSApp postEvent:event atStart:YES]; } bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) |