diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 7320fc11e6..95fe9129d3 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -100,11 +100,23 @@ static void cleanupCocoaApplicationDelegate() - (id)init { self = [super init]; - if (self) + if (self) { inLaunch = true; + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(updateScreens:) + name:NSApplicationDidChangeScreenParametersNotification + object:NSApp]; + } return self; } +- (void)updateScreens:(NSNotification *)notification +{ + if (QCocoaIntegration *ci = dynamic_cast<QCocoaIntegration *>(QGuiApplicationPrivate::platformIntegration())) + ci->updateScreens(); +} + - (void)dealloc { sharedCocoaApplicationDelegate = nil; @@ -114,6 +126,8 @@ static void cleanupCocoaApplicationDelegate() [NSApp setDelegate:reflectionDelegate]; [reflectionDelegate release]; } + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [super dealloc]; } |