mirror of
https://github.com/crystalidea/qt-build-tools.git
synced 2024-11-23 03:10:06 +08:00
Update qcocoascreen.mm
This commit is contained in:
parent
8c4fcbf49e
commit
e7f4cef233
@ -131,7 +131,7 @@ void QCocoaScreen::initializeScreens()
|
|||||||
}
|
}
|
||||||
}, nullptr);
|
}, nullptr);
|
||||||
|
|
||||||
static QMacNotificationObserver screenParamaterObserver(NSApplication.sharedApplication,
|
static QMacNotificationObserver screenParameterObserver(NSApplication.sharedApplication,
|
||||||
NSApplicationDidChangeScreenParametersNotification, [&]() {
|
NSApplicationDidChangeScreenParametersNotification, [&]() {
|
||||||
qCDebug(lcQpaScreen) << "Received screen parameter change notification";
|
qCDebug(lcQpaScreen) << "Received screen parameter change notification";
|
||||||
updateScreensIfNeeded(); // As a last resort we update screens here
|
updateScreensIfNeeded(); // As a last resort we update screens here
|
||||||
@ -187,7 +187,7 @@ void QCocoaScreen::updateScreens()
|
|||||||
for (CGDirectDisplayID displayId : onlineDisplays) {
|
for (CGDirectDisplayID displayId : onlineDisplays) {
|
||||||
Q_ASSERT(CGDisplayIsOnline(displayId));
|
Q_ASSERT(CGDisplayIsOnline(displayId));
|
||||||
|
|
||||||
if (CGDirectDisplayID mirroring = CGDisplayMirrorsDisplay(displayId))
|
if (CGDisplayMirrorsDisplay(displayId))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// A single physical screen can map to multiple displays IDs,
|
// A single physical screen can map to multiple displays IDs,
|
||||||
@ -213,9 +213,7 @@ void QCocoaScreen::updateScreens()
|
|||||||
|
|
||||||
for (QScreen *screen : QGuiApplication::screens()) {
|
for (QScreen *screen : QGuiApplication::screens()) {
|
||||||
QCocoaScreen *platformScreen = static_cast<QCocoaScreen*>(screen->handle());
|
QCocoaScreen *platformScreen = static_cast<QCocoaScreen*>(screen->handle());
|
||||||
if (!platformScreen->isOnline())
|
if (!platformScreen->isOnline() || platformScreen->isMirroring())
|
||||||
platformScreen->remove();
|
|
||||||
else if (platformScreen->isMirroring())
|
|
||||||
platformScreen->remove();
|
platformScreen->remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user