summaryrefslogtreecommitdiff
path: root/patches/qt4/patch-qeventdispatcher.diff
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-12-08 20:16:58 (GMT)
committerMarius Kintel <marius@kintel.net>2013-12-08 20:16:58 (GMT)
commit88cc7edafd47ec167609c05eb22c3f8eb642d225 (patch)
treea9b47b56a3884f83d3c6e469b6c4c45dc1c57060 /patches/qt4/patch-qeventdispatcher.diff
parentb131464f954b2d10f6b065b45038652af2379742 (diff)
#559 Fix Qt font rendering on OS X 10.9
Diffstat (limited to 'patches/qt4/patch-qeventdispatcher.diff')
-rw-r--r--patches/qt4/patch-qeventdispatcher.diff86
1 files changed, 86 insertions, 0 deletions
diff --git a/patches/qt4/patch-qeventdispatcher.diff b/patches/qt4/patch-qeventdispatcher.diff
new file mode 100644
index 0000000..89ed478
--- /dev/null
+++ b/patches/qt4/patch-qeventdispatcher.diff
@@ -0,0 +1,86 @@
+--- src/gui/kernel/qeventdispatcher_mac_p.h 2013-06-07 01:16:59.000000000 -0400
++++ src/gui/kernel/qeventdispatcher_mac_p_new-8184b49c12d887928921ed5b695c8c6f04a07514.h 2013-12-08 14:31:01.000000000 -0500
+@@ -173,6 +173,7 @@
+ #ifdef QT_MAC_USE_COCOA
+ // The following variables help organizing modal sessions:
+ static QStack<QCocoaModalSessionInfo> cocoaModalSessionStack;
++ static QStack<QCocoaModalSessionInfo> cocoaModalSessionStackPendingEnd;
+ static bool currentExecIsNSAppRun;
+ static bool nsAppRunCalledByQt;
+ static bool cleanupModalSessionsNeeded;
+@@ -180,6 +181,7 @@
+ static NSModalSession currentModalSession();
+ static void updateChildrenWorksWhenModal();
+ static void temporarilyStopAllModalSessions();
++ static void stopAllPendingEndModalSessions();
+ static void beginModalSession(QWidget *widget);
+ static void endModalSession(QWidget *widget);
+ static void cancelWaitForMoreEvents();
+--- src/gui/kernel/qeventdispatcher_mac.mm 2013-06-07 01:16:59.000000000 -0400
++++ src/gui/kernel/qeventdispatcher_mac_new-833e02de99494686f8dd7a567f6e19e847508f11.mm 2013-12-08 14:30:59.000000000 -0500
+@@ -603,6 +603,9 @@
+ while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt)
+ qt_mac_waitForMoreModalSessionEvents();
+
++ // stop all pending end modal sessions
++ d->stopAllPendingEndModalSessions();
++
+ if (!d->interrupt && session == d->currentModalSessionCached) {
+ // Someone called [NSApp stopModal:] from outside the event
+ // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
+@@ -678,6 +681,9 @@
+ if (!d->interrupt)
+ QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
+
++ // stop all pending end modal sessions
++ d->stopAllPendingEndModalSessions();
++
+ // Since the window that holds modality might have changed while processing
+ // events, we we need to interrupt when we return back the previous process
+ // event recursion to ensure that we spin the correct modal session.
+@@ -781,6 +787,7 @@
+
+ #ifdef QT_MAC_USE_COCOA
+ QStack<QCocoaModalSessionInfo> QEventDispatcherMacPrivate::cocoaModalSessionStack;
++QStack<QCocoaModalSessionInfo> QEventDispatcherMacPrivate::cocoaModalSessionStackPendingEnd;
+ bool QEventDispatcherMacPrivate::currentExecIsNSAppRun = false;
+ bool QEventDispatcherMacPrivate::nsAppRunCalledByQt = false;
+ bool QEventDispatcherMacPrivate::cleanupModalSessionsNeeded = false;
+@@ -828,6 +835,20 @@
+ currentModalSessionCached = 0;
+ }
+
++void QEventDispatcherMacPrivate::stopAllPendingEndModalSessions()
++{
++ // stop all modal sessions pending end
++ int stackSize = cocoaModalSessionStackPendingEnd.size();
++ for (int i=stackSize-1; i>=0; --i) {
++ QCocoaModalSessionInfo &info = cocoaModalSessionStackPendingEnd[i];
++ cocoaModalSessionStackPendingEnd.remove(i);
++ if (info.session) {
++ [NSApp endModalSession:info.session];
++ [(NSWindow *)info.nswindow release];
++ }
++ }
++}
++
+ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
+ {
+ // If we have one or more modal windows, this function will create
+@@ -925,10 +946,12 @@
+ }
+ cocoaModalSessionStack.remove(i);
+ currentModalSessionCached = 0;
+- if (info.session) {
+- [NSApp endModalSession:info.session];
+- [(NSWindow *)info.nswindow release];
+- }
++
++ // Cannot stop the sessions here since we might still be inside a
++ // [NSApp runModalSession:] call. Add the session to the pending end stack and
++ // process the stack after the call to [NSApp runModalSession:] returns.
++ if (info.session)
++ cocoaModalSessionStackPendingEnd.push(info);
+ }
+
+ updateChildrenWorksWhenModal();
contact: Jan Huwald // Impressum