diff options
author | Andy Shaw <andy.shaw@digia.com> | 2014-05-19 19:58:35 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-26 11:16:38 +0200 |
commit | 5d48eb8bbc43b37235c29c2caf1e5fafec864b49 (patch) | |
tree | 004a272ae750f7778b56f2513723db28d62f3bd9 /src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | |
parent | f7af9fb63244b114653c157d3eef3e6c64f3196a (diff) | |
download | qtbase-5d48eb8bbc43b37235c29c2caf1e5fafec864b49.tar.gz |
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.mm | 6 |
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; |