diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2014-10-01 16:21:12 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-10-01 16:21:12 +0200 |
commit | 8ee9774e67edf57d891528749a360a0af8f0c6f7 (patch) | |
tree | e0b7d4b19c26c48fe41e930532f2037f8dc43204 /src/plugins/platforms/cocoa | |
parent | d78fb442d750b33afe2e41f31588ec94cf4023ad (diff) | |
parent | 8ab25620d3df25c43011ae982f4614639578afb3 (diff) |
Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 4 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 33 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 2 |
3 files changed, 37 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index f021446438..78465b896d 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -703,9 +703,8 @@ bool QCocoaFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate() { - if (mDelegate) - return; QCocoaAutoReleasePool pool; + const SharedPointerFileDialogOptions &opts = options(); const QList<QUrl> selectedFiles = opts->initiallySelectedFiles(); const QUrl directory = mDir.isEmpty() ? opts->initialDirectory() : mDir; @@ -717,6 +716,7 @@ void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate() options:opts helper:this]; + [static_cast<QNSOpenSavePanelDelegate *>(mDelegate) release]; mDelegate = delegate; } diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 7e22351818..a0e02501de 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -82,6 +82,32 @@ static bool isMouseEvent(NSEvent *ev) } } +static void selectNextKeyWindow(NSWindow *currentKeyWindow) +{ + if (!currentKeyWindow) + return; + + const QCocoaAutoReleasePool pool; + + if ([[NSApplication sharedApplication] keyWindow] != currentKeyWindow) + return;//currentKeyWindow is not a key window actually. + + NSArray *const windows = [[NSApplication sharedApplication] windows]; + bool startLookup = false; + for (NSWindow *candidate in [windows reverseObjectEnumerator]) { + if (!startLookup) { + if (candidate == currentKeyWindow) + startLookup = true; + } else { + if ([candidate isVisible] && [candidate canBecomeKeyWindow]) { + [candidate makeKeyWindow]; + break; + } + } + } +} + + @interface NSWindow (CocoaWindowCategory) - (NSRect) legacyConvertRectFromScreen:(NSRect) rect; @end @@ -592,6 +618,9 @@ void QCocoaWindow::hide(bool becauseOfAncestor) foreach (QCocoaWindow *childWindow, m_childWindows) childWindow->hide(true); + if (window()->transientParent() && m_nsWindow == [[NSApplication sharedApplication] keyWindow]) + selectNextKeyWindow(m_nsWindow); // Otherwise, Cocoa can do it wrong. + [m_nsWindow orderOut:nil]; } @@ -1456,7 +1485,11 @@ void QCocoaWindow::setNSWindow(QCocoaNSWindow *window) { if (window.contentView != m_contentView) { [m_contentView setPostsFrameChangedNotifications: NO]; + [m_contentView retain]; + if (m_contentView.superview) // m_contentView comes from another NSWindow + [m_contentView removeFromSuperview]; [window setContentView:m_contentView]; + [m_contentView release]; [m_contentView setPostsFrameChangedNotifications: YES]; } } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index d72664f0a0..73f8d276a8 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -594,6 +594,8 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; CGImageRelease(subMask); [self invalidateWindowShadowIfNeeded]; + + m_backingStore = 0; } - (BOOL) isFlipped |