From 5ec108eb7a41b818dc49752e7a5c1d3c4f7f3877 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 14 Dec 2015 10:20:47 +0100 Subject: [PATCH] Cocoa integration - handle didResignKey correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we receive didResignKey notification, before setting active window to null we check that [NSApp keyWindow] is nil, but it's not. At the same moment, [NSApp keyWindow] == windowNotification.object - so it's indeed the window that resigned the key status, it's just NSApp keyWindow that is not nil yet. Change-Id: Iedc85d806c7d583a2054dc4d7168af13c9c7a4e0 Task-number: QTBUG-49925 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 8733116c6f..e0163e441e 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -423,7 +423,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; // set the active window to zero here, the new key window's // NSWindowDidBecomeKeyNotification hander will change the active window NSWindow *keyWindow = [NSApp keyWindow]; - if (!keyWindow) { + if (!keyWindow || keyWindow == windowNotification.object) { // no new key window, go ahead and set the active window to zero if (!m_platformWindow->windowIsPopupType() && !m_isMenuView) QWindowSystemInterface::handleWindowActivated(0);