From 5bf9528b9164bd888e991552b66d6237e84a7ee2 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 17 Feb 2015 17:19:42 +0100 Subject: Revert "OS X: main window doesn't become key." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit da0c74550f0e8a21239896d6aead6e05f85eb695. The patch da0c74 unfortunately does not work well with QCocoaMenuBar's logic: it can happen that our selectNextKeyWindow chooses a Popup or another window with some 'unusual' flag as a key, but QCocoaMenuBar::updateMenuBarImmediately will return immediately, assuming that popup does not have a menu and there are no menu items to enable. Task-number: QTBUG-44369 Change-Id: I83cd2f6a62acd3a6ceb4d9dbf53ca42af67476d8 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 6656212457..2adea0f493 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -82,31 +82,6 @@ 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; - } - } - } -} - @implementation QNSWindowHelper @synthesize window = _window; @@ -599,9 +574,6 @@ 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]; } -- cgit v1.2.3