diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 6ce71845703..2d55524f6ff 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -226,6 +226,7 @@ private: xcb_randr_get_output_info_reply_t *outputInfo); void destroyScreen(QXcbScreen *screen); void initializeScreens(bool initialized); + void initializeScreensWithoutXRandR(xcb_screen_iterator_t *it, int screenNumber, QXcbScreen **primaryScreen); void initializeScreensFromOutput(xcb_screen_iterator_t *it, int screenNumber, QXcbScreen **primaryScreen); void updateScreen_monitor(QXcbScreen *screen, xcb_randr_monitor_info_t *monitorInfo, xcb_timestamp_t timestamp = XCB_NONE); diff --git a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp index 149824bc929..aa0f2fef658 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp @@ -317,6 +317,10 @@ void QXcbConnection::initializeScreens(bool initialized) initializeScreensFromMonitor(&it, xcbScreenNumber, &primaryScreen, initialized); else if (isAtLeastXRandR12()) initializeScreensFromOutput(&it, xcbScreenNumber, &primaryScreen); + else { + qWarning("There is no XRandR 1.2 and later version available. There will be only fake screen(s) to use."); + initializeScreensWithoutXRandR(&it, xcbScreenNumber, &primaryScreen); + } xcb_screen_next(&it); ++xcbScreenNumber; @@ -349,6 +353,26 @@ void QXcbConnection::initializeScreens(bool initialized) } } +void QXcbConnection::initializeScreensWithoutXRandR(xcb_screen_iterator_t *it, int xcbScreenNumber, QXcbScreen **primaryScreen) +{ + // XRandR extension is missing, then create a fake/legacy screen. + xcb_screen_t *xcbScreen = it->data; + QXcbVirtualDesktop *virtualDesktop = new QXcbVirtualDesktop(this, xcbScreen, xcbScreenNumber); + m_virtualDesktops.append(virtualDesktop); + QList siblings; + + QXcbScreen *screen = new QXcbScreen(this, virtualDesktop, XCB_NONE, nullptr); + qCDebug(lcQpaScreen) << "created fake screen" << screen; + m_screens << screen; + + if (primaryScreenNumber() == xcbScreenNumber) { + *primaryScreen = screen; + (*primaryScreen)->setPrimary(true); + } + siblings << screen; + virtualDesktop->setScreens(std::move(siblings)); +} + void QXcbConnection::initializeScreensFromOutput(xcb_screen_iterator_t *it, int xcbScreenNumber, QXcbScreen **primaryScreen) { // Each "screen" in xcb terminology is a virtual desktop,