macOS: Add logging of screen add/remove/changes
Change-Id: Ic9c9ac307441dde98bb43d656466a03805746917 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
2b7cf045bf
commit
8ba1f91d4e
@ -222,6 +222,8 @@ QCocoaIntegration::Options QCocoaIntegration::options() const
|
||||
return mOptions;
|
||||
}
|
||||
|
||||
Q_LOGGING_CATEGORY(lcCocoaScreen, "qt.qpa.cocoa.screens");
|
||||
|
||||
/*!
|
||||
\brief Synchronizes the screen list, adds new screens, removes deleted ones
|
||||
*/
|
||||
@ -261,9 +263,11 @@ void QCocoaIntegration::updateScreens()
|
||||
if (screen) {
|
||||
remainingScreens.remove(screen);
|
||||
screen->updateGeometry();
|
||||
qCDebug(lcCocoaScreen) << "Updated properties of" << screen;
|
||||
} else {
|
||||
screen = new QCocoaScreen(i);
|
||||
mScreens.append(screen);
|
||||
qCDebug(lcCocoaScreen) << "Adding" << screen;
|
||||
screenAdded(screen);
|
||||
}
|
||||
siblings << screen;
|
||||
@ -280,6 +284,7 @@ void QCocoaIntegration::updateScreens()
|
||||
mScreens.removeOne(screen);
|
||||
// Prevent stale references to NSScreen during destroy
|
||||
screen->m_screenIndex = -1;
|
||||
qCDebug(lcCocoaScreen) << "Removing" << screen;
|
||||
destroyScreen(screen);
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +102,10 @@ public:
|
||||
QList<QPlatformScreen *> m_siblings;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug debug, const QCocoaScreen *screen);
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
@ -275,4 +275,22 @@ QCocoaScreen *QCocoaScreen::primaryScreen()
|
||||
return static_cast<QCocoaScreen *>(QGuiApplication::primaryScreen()->handle());
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug debug, const QCocoaScreen *screen)
|
||||
{
|
||||
QDebugStateSaver saver(debug);
|
||||
debug.nospace();
|
||||
debug << "QCocoaScreen(" << (const void *)screen;
|
||||
if (screen) {
|
||||
debug << ", index=" << screen->m_screenIndex;
|
||||
debug << ", native=" << screen->nativeScreen();
|
||||
debug << ", geometry=" << screen->geometry();
|
||||
debug << ", dpr=" << screen->devicePixelRatio();
|
||||
debug << ", name=" << screen->name();
|
||||
}
|
||||
debug << ')';
|
||||
return debug;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
Reference in New Issue
Block a user