diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 7 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 15 | ||||
-rw-r--r-- | src/widgets/kernel/qdesktopwidget.qdoc | 5 |
3 files changed, 16 insertions, 11 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 243ef70efc..8c49b3a2b5 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -873,9 +873,14 @@ QWindowList QGuiApplication::topLevelWindows() } /*! - Returns the primary (or default) screen of the application. + Returns the primary (or default) screen of the application, or null if there is none This will be the screen where QWindows are initially shown, unless otherwise specified. + + On some platforms, it may be null when there are actually no screens connected. + It is not possible to start a new QGuiApplication while there are no screens. + Applications which were running at the time the primary screen was removed + will stop rendering graphics until one or more screens are restored. */ QScreen *QGuiApplication::primaryScreen() { diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 9247da814d..da973b5313 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -215,16 +215,6 @@ void QXcbConnection::updateScreens() } free(primary); } - // If there's no randr extension, or there was some error above, or the screen - // doesn't have outputs for some other reason (e.g. on VNC or ssh -X), just assume there is one screen. - if (connectedOutputCount == 0) { - qCDebug(lcQpaScreen, "found a screen with zero outputs"); - QXcbScreen *screen = findOrCreateScreen(newScreens, xcbScreenNumber, xcbScreen); - siblings << screen; - activeScreens << screen; - if (!primaryScreen) - primaryScreen = screen; - } foreach (QPlatformScreen* s, siblings) ((QXcbScreen*)s)->setVirtualSiblings(siblings); xcb_screen_next(&it); @@ -282,6 +272,11 @@ void QXcbConnection::updateScreens() if (!m_screens.isEmpty()) qCDebug(lcQpaScreen) << "primary output is" << m_screens.first()->name(); + else + // QTBUG-40174, QTBUG-42985: If there are no outputs, then there must be + // no QScreen instances; a Qt application can survive this situation, and + // start rendering again later when there is a screen again. + qCDebug(lcQpaScreen) << "xcb connection has no outputs"; } QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, const char *displayName) diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc index 822bb47a15..6ce312dc2f 100644 --- a/src/widgets/kernel/qdesktopwidget.qdoc +++ b/src/widgets/kernel/qdesktopwidget.qdoc @@ -238,6 +238,11 @@ \property QDesktopWidget::screenCount \brief the number of screens currently available on the system. + Note that on some platforms, screenCount will be zero if there are actually + no screens connected. Applications which were running at the time the + screenCount went to zero will stop rendering graphics until one or more + screens are restored. + \since 4.6 */ |