Cocoa integration - handle didResignKey correctly

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 <morten.sorvig@theqtcompany.com>
This commit is contained in:
Timur Pocheptsov 2015-12-14 10:20:47 +01:00
parent 2613317512
commit 5ec108eb7a

View File

@ -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);