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 <bradley.hughes@nokia.com>
This commit is contained in:
Morten Johan Sorvig 2012-03-20 08:32:55 +01:00 committed by Qt by Nokia
parent fcc01e6c37
commit 10537187b9

View File

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