diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 22 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.mm | 3 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index f8411845dc..d322079cb2 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -333,6 +333,7 @@ static void cleanupCocoaApplicationDelegate() && [reflectionDelegate respondsToSelector:@selector(applicationDidBecomeActive:)]) [reflectionDelegate applicationDidBecomeActive:notification]; + QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive); /* onApplicationChangedActivation(true); @@ -356,6 +357,7 @@ static void cleanupCocoaApplicationDelegate() && [reflectionDelegate respondsToSelector:@selector(applicationDidResignActive:)]) [reflectionDelegate applicationDidResignActive:notification]; + QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationInactive); /* onApplicationChangedActivation(false); @@ -367,6 +369,26 @@ static void cleanupCocoaApplicationDelegate() */ } +- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag +{ + Q_UNUSED(theApplication); + Q_UNUSED(flag); + if (reflectionDelegate + && [reflectionDelegate respondsToSelector:@selector(applicationShouldHandleReopen:hasVisibleWindows:)]) + return [reflectionDelegate applicationShouldHandleReopen:theApplication hasVisibleWindows:flag]; + + /* + true to force delivery of the event even if the application state is already active, + because rapp (handle reopen) events are sent each time the dock icon is clicked regardless + of the active state of the application or number of visible windows. For example, a browser + app that has no windows opened would need the event be to delivered even if it was already + active in order to create a new window as per OS X conventions. + */ + QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive, true /*forcePropagate*/); + + return NO; +} + - (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate { [oldDelegate retain]; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index c4398622e8..e7a973e45b 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -405,14 +405,13 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons case MultipleWindows: case ForeignWindows: case RasterGLSurface: + case ApplicationState: return true; default: return QPlatformIntegration::hasCapability(cap); } } - - QPlatformWindow *QCocoaIntegration::createPlatformWindow(QWindow *window) const { return new QCocoaWindow(window); |