macOS: Decouple screen property updates from application delegate
Change-Id: I489c37131bf715d45f147964de4a8cd8c02adbcb Fixes: QTBUG-72966 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
5c014a48dc
commit
10565c5ef3
@ -115,22 +115,10 @@ QT_USE_NAMESPACE
|
|||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
inLaunch = true;
|
inLaunch = true;
|
||||||
[[NSNotificationCenter defaultCenter]
|
|
||||||
addObserver:self
|
|
||||||
selector:@selector(updateScreens:)
|
|
||||||
name:NSApplicationDidChangeScreenParametersNotification
|
|
||||||
object:NSApp];
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateScreens:(NSNotification *)notification
|
|
||||||
{
|
|
||||||
Q_UNUSED(notification);
|
|
||||||
if (QCocoaIntegration *ci = QCocoaIntegration::instance())
|
|
||||||
ci->updateScreens();
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[_dockMenu release];
|
[_dockMenu release];
|
||||||
|
@ -144,6 +144,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
QScopedPointer<QPlatformTheme> mPlatformTheme;
|
QScopedPointer<QPlatformTheme> mPlatformTheme;
|
||||||
QList<QCocoaScreen *> mScreens;
|
QList<QCocoaScreen *> mScreens;
|
||||||
|
QMacScopedObserver m_screensObserver;
|
||||||
#ifndef QT_NO_CLIPBOARD
|
#ifndef QT_NO_CLIPBOARD
|
||||||
QCocoaClipboard *mCocoaClipboard;
|
QCocoaClipboard *mCocoaClipboard;
|
||||||
#endif
|
#endif
|
||||||
|
@ -206,6 +206,9 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList)
|
|||||||
// by explicitly setting the presentation option to the magic 'default value',
|
// by explicitly setting the presentation option to the magic 'default value',
|
||||||
// which will resolve to an actual value and result in screen invalidation.
|
// which will resolve to an actual value and result in screen invalidation.
|
||||||
cocoaApplication.presentationOptions = NSApplicationPresentationDefault;
|
cocoaApplication.presentationOptions = NSApplicationPresentationDefault;
|
||||||
|
|
||||||
|
m_screensObserver = QMacScopedObserver([NSApplication sharedApplication],
|
||||||
|
NSApplicationDidChangeScreenParametersNotification, [&]() { updateScreens(); });
|
||||||
updateScreens();
|
updateScreens();
|
||||||
|
|
||||||
QMacInternalPasteboardMime::initializeMimeTypes();
|
QMacInternalPasteboardMime::initializeMimeTypes();
|
||||||
|
Loading…
Reference in New Issue
Block a user