diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2009-08-11 14:02:27 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2009-08-14 10:47:47 (GMT) |
commit | dc2070d82c3d3cd972a52df680c6df9d2989f3e4 (patch) | |
tree | bc4a905853ece743966427a41ccf04b9374729c3 /src/gui/kernel/qeventdispatcher_mac_p.h | |
parent | 433ae0c05079f09293667e495bdb3583616cec6c (diff) | |
download | Qt-dc2070d82c3d3cd972a52df680c6df9d2989f3e4.zip Qt-dc2070d82c3d3cd972a52df680c6df9d2989f3e4.tar.gz Qt-dc2070d82c3d3cd972a52df680c6df9d2989f3e4.tar.bz2 |
Cocoa: Fix several issues with the event dispatcher
Autotest: qcoreapplication, qapplication, qtimer
qwidget_window, qwidget
Issue 1: stacking order of modal windows was not
working correctly. With this patch, we remove the
need for rebuilding modal sessions all the time,
and when we do, we rebuild them all in the correct
order.
Issue 2: When running the event processor manually
(that is, just calling processEvents in a loop), we
sometimes spendt 100% cpu if a window was pending to
become modal. The reason was that we need to keep
reposting the QCocoaRequestModal event until we
could block the calling thread (that is, one of
the exec flags was given to processEvents). With this
patch, the need for posting QCocoaRequestModal is
completly removed in favor of an 'interrupt'
approach instead.
Issue 3: If using Qt as a plugin, or just add widget
to a native cocoa application, it would often lead
to closing down the application. The reason is that
the event dispatcher needs to restart [NSApp run]
now and then. But this approach fails if Qt was not
the code that started [NSApp run] in the first place.
This patch removes the need to restart NSApp in this
situation, at the cost of modal windows not beeing
modal if Qt is not spinning the event dispatcher.
Normal QDialog::exec etc will always work.
Diffstat (limited to 'src/gui/kernel/qeventdispatcher_mac_p.h')
-rw-r--r-- | src/gui/kernel/qeventdispatcher_mac_p.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/gui/kernel/qeventdispatcher_mac_p.h index 225d32e..6747d52 100644 --- a/src/gui/kernel/qeventdispatcher_mac_p.h +++ b/src/gui/kernel/qeventdispatcher_mac_p.h @@ -172,9 +172,15 @@ public: #ifdef QT_MAC_USE_COCOA // The following variables help organizing modal sessions: static QStack<QCocoaModalSessionInfo> cocoaModalSessionStack; - static bool blockCocoaRequestModal; - static NSModalSession activeModalSession(); - static void rebuildModalSessionStack(bool pop); + static bool currentExecIsNSAppRun; + static bool nsAppRunCalledByQt; + static NSModalSession currentModalSessionCached; + static void updateChildrenWorksWhenModal(); + static NSModalSession currentModalSession(); + static int activeModalSessionCount(); + static void temporarilyStopAllModalSessions(); + static void beginModalSession(QWidget *widget); + static void endModalSession(QWidget *widget); #endif MacSocketHash macSockets; @@ -192,6 +198,20 @@ private: CFRunLoopActivity activity, void *info); }; +#ifdef QT_MAC_USE_COCOA +class QtMacInterruptDispatcherHelp : public QObject +{ + static QtMacInterruptDispatcherHelp *instance; + bool cancelled; + + QtMacInterruptDispatcherHelp(); + ~QtMacInterruptDispatcherHelp(); + + public: + static void interruptLater(); +}; +#endif + QT_END_NAMESPACE #endif // QEVENTDISPATCHER_MAC_P_H |