summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2014-05-19 19:58:35 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-26 11:16:38 +0200
commit5d48eb8bbc43b37235c29c2caf1e5fafec864b49 (patch)
tree004a272ae750f7778b56f2513723db28d62f3bd9 /src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
parentf7af9fb63244b114653c157d3eef3e6c64f3196a (diff)
Cocoa: Make sure modal windows get correct geometry on show
beginModalSessionForWindow will center the window and ignore the set geometry. So to workaround this it checks the new value against the old one and moves it back if need be. Change-Id: I38bc74c04138992f2e0570fca666414025aeeba8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index e0ce9f9648..b625f233ce 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -622,7 +622,8 @@ NSModalSession QCocoaEventDispatcherPrivate::currentModalSession()
if (!info.session) {
QCocoaAutoReleasePool pool;
- NSWindow *nswindow = static_cast<QCocoaWindow *>(info.window->handle())->nativeWindow();
+ QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(info.window->handle());
+ NSWindow *nswindow = cocoaWindow->nativeWindow();
if (!nswindow)
continue;
@@ -630,7 +631,10 @@ NSModalSession QCocoaEventDispatcherPrivate::currentModalSession()
QBoolBlocker block1(blockSendPostedEvents, true);
info.nswindow = nswindow;
[(NSWindow*) info.nswindow retain];
+ QRect rect = cocoaWindow->geometry();
info.session = [NSApp beginModalSessionForWindow:nswindow];
+ if (rect != cocoaWindow->geometry())
+ cocoaWindow->setGeometry(rect);
}
currentModalSessionCached = info.session;
cleanupModalSessionsNeeded = false;