diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-08-13 12:05:17 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-08-13 12:34:14 (GMT) |
commit | 6d0d767e63df3c997d6d7a8cb6cd4bf8c0dfc835 (patch) | |
tree | aec6c26c1586a86b1f0d1d07181bce19d1771b48 /src/gui/kernel | |
parent | 6c12093da30c1a48feb04e45fd10f851fc3d39cd (diff) | |
download | Qt-6d0d767e63df3c997d6d7a8cb6cd4bf8c0dfc835.zip Qt-6d0d767e63df3c997d6d7a8cb6cd4bf8c0dfc835.tar.gz Qt-6d0d767e63df3c997d6d7a8cb6cd4bf8c0dfc835.tar.bz2 |
Cocoa: Stacking order of modal dialogs is wrong
Modal dialogs were sometimes hidden behind other normal windows
on screen. The reason was that, upon going modal for a window, we
actually resat the stacking level on the window in a faulty
attempt to respect any stays-on-top window flags. This patch
makes sure we avoid doing that, and at the same time, ensures
we don't reintroduce the original bug as well.
Task-number: QTBUG-12841
Reviewed-by: cduclos
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qeventdispatcher_mac.mm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index e26fbde..89f01d8 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -785,7 +785,7 @@ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() // the stacking order of the windows while doing so, we put // up a block that is used in QCocoaWindow and QCocoaPanel: int stackSize = cocoaModalSessionStack.size(); - for (int i=stackSize-1; i>=0; --i) { + for (int i=0; i<stackSize; ++i) { QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; if (info.session) { [NSApp endModalSession:info.session]; @@ -822,12 +822,12 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession() QBoolBlocker block1(blockSendPostedEvents, true); info.nswindow = window; [(NSWindow*) info.nswindow retain]; - // When creating a modal session cocoa will rearrange the windows. - // In order to avoid windows to be put behind another we need to - // keep the window level. - int level = [window level]; + int levelBeforeEnterModal = [window level]; info.session = [NSApp beginModalSessionForWindow:window]; - [window setLevel:level]; + // Make sure we don't stack the window lower that it was before + // entering modal, in case it e.g. had the stays-on-top flag set: + if (levelBeforeEnterModal > [window level]) + [window setLevel:levelBeforeEnterModal]; } currentModalSessionCached = info.session; } |