From 10537187b978df899a20e9997b859c60841bb5cc Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Tue, 20 Mar 2012 08:32:55 +0100 Subject: [PATCH] Cocoa: Panels can become key windows too. The cocoa plugin uses NSPanel instead of NSWindow for popup-type windows. With the exception of tooltips and splash screens these windows should take input focus as well. Change-Id: Icdf0854e7c511ccc106e035dae4763ae90c23aa5 Reviewed-by: Bradley T. Hughes --- src/plugins/platforms/cocoa/qcocoawindow.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index d432740..a76830f 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -83,7 +83,12 @@ - (BOOL)canBecomeKeyWindow { - return NO; + // Most panels can be come the key window. Exceptions are: + if (m_cocoaPlatformWindow->window()->windowType() == Qt::ToolTip) + return NO; + if (m_cocoaPlatformWindow->window()->windowType() == Qt::SplashScreen) + return NO; + return YES; } @end @@ -357,6 +362,7 @@ NSWindow * QCocoaWindow::createNSWindow() defer:NO]; // Deferring window creation breaks OpenGL (the GL context is set up // before the window is shown and needs a proper window.). [window setHasShadow:YES]; + window->m_cocoaPlatformWindow = this; createdWindow = window; } else { styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask); -- 2.7.4