From 5d48eb8bbc43b37235c29c2caf1e5fafec864b49 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 19 May 2014 19:58:35 +0200 Subject: Cocoa: Make sure modal windows get correct geometry on show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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(info.window->handle())->nativeWindow(); + QCocoaWindow *cocoaWindow = static_cast(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; -- cgit v1.2.3