summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-05-14 11:30:35 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-28 11:47:11 +0200
commit626e0f204e846040e8e3a67bfc088f09b5091e7c (patch)
treeecb37b8a0502a784ea5e12d61dca6a9d87b69af1 /src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
parent1d58face30c2936657c4372c6237e2fe64e4095b (diff)
Revert "Cocoa: Post event to "show()" a modal window"
This reverts commit a9cbddf4739f3cfabd38367b5f872fe2c1a3814c. The reverted commit is an incorrect bug-fix for a regression introduced by adding a call to [NSApp abortModal] in change d9875f7b. Change-Id: If23463ebdfe2ff64c68739dbece73a13773683c9 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index b625f233ce..98becf0728 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -738,25 +738,13 @@ void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window)
updateChildrenWorksWhenModal();
currentModalSessionCached = 0;
if (currentExecIsNSAppRun) {
- QEvent *e = new QEvent(QEvent::User);
- qApp->postEvent(q, e, Qt::HighEventPriority);
+ modalSessionOnNSAppRun = true;
+ q->wakeUp();
} else {
q->interrupt();
}
}
-bool QCocoaEventDispatcher::event(QEvent *e)
-{
- Q_D(QCocoaEventDispatcher);
-
- if (e->type() == QEvent::User) {
- d->q_func()->processEvents(QEventLoop::DialogExec | QEventLoop::EventLoopExec | QEventLoop::WaitForMoreEvents);
- return true;
- }
-
- return QObject::event(e);
-}
-
void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
{
Q_Q(QCocoaEventDispatcher);
@@ -793,6 +781,7 @@ QCocoaEventDispatcherPrivate::QCocoaEventDispatcherPrivate()
runLoopTimerRef(0),
blockSendPostedEvents(false),
currentExecIsNSAppRun(false),
+ modalSessionOnNSAppRun(false),
nsAppRunCalledByQt(false),
cleanupModalSessionsNeeded(false),
processEventsCalled(0),
@@ -923,6 +912,14 @@ void QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void *info)
// processEvents() was called "manually," ignore this source for now
d->maybeCancelWaitForMoreEvents();
return;
+ } else if (d->modalSessionOnNSAppRun) {
+ // We're about to spawn the 1st modal session on top of the main runloop.
+ // Instead of calling processPostedEvents(), which would need us stop
+ // NSApp, we just re-enter processEvents(). This is equivalent to calling
+ // QDialog::exec() except that it's done in a non-blocking way.
+ d->modalSessionOnNSAppRun = false;
+ d->q_func()->processEvents(QEventLoop::DialogExec | QEventLoop::EventLoopExec | QEventLoop::WaitForMoreEvents);
+ return;
}
d->processPostedEvents();
d->maybeCancelWaitForMoreEvents();