From 2b94453cbdab5c691c830ff539e81408d5330e3b Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 24 Feb 2023 15:53:19 +0100 Subject: xcb: ignore the xscreens which don't belong to current connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This amends 9a4c98e55659b32db984612e6247ac193812a502. When a X server has multiple xscreens, for example, ":0.0" and ":0.1", a Qt application, which uses ":0.1" as display, can't use the randr monitor from other connection(":0.0") to show contents there. Then we don't need to generate QXcbScreen for them. Pick-to: 6.4 6.5 Fixes: QTBUG-110898 Change-Id: I04c1512664b763ffabb55b75db4411d100536255 Reviewed-by: Tor Arne Vestbø Reviewed-by: JiDe Zhang Reviewed-by: Liang Qi --- .../platforms/xcb/qxcbconnection_screens.cpp | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp index bfa22072ed..c31e9b1039 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp @@ -489,6 +489,10 @@ void QXcbConnection::initializeScreensFromMonitor(xcb_screen_iterator_t *it, int virtualDesktop = new QXcbVirtualDesktop(this, xcbScreen, xcbScreenNumber); m_virtualDesktops.append(virtualDesktop); } + + if (xcbScreenNumber != primaryScreenNumber()) + return; + QList old = virtualDesktop->m_screens; QList siblings; @@ -521,14 +525,12 @@ void QXcbConnection::initializeScreensFromMonitor(xcb_screen_iterator_t *it, int siblings << screen; // similar logic with QXcbConnection::initializeScreensFromOutput() - if (primaryScreenNumber() == xcbScreenNumber) { - if (!(*primaryScreen) || monitor_info->primary) { - if (*primaryScreen) - (*primaryScreen)->setPrimary(false); - *primaryScreen = screen; - (*primaryScreen)->setPrimary(true); - siblings.prepend(siblings.takeLast()); - } + if (!(*primaryScreen) || monitor_info->primary) { + if (*primaryScreen) + (*primaryScreen)->setPrimary(false); + *primaryScreen = screen; + (*primaryScreen)->setPrimary(true); + siblings.prepend(siblings.takeLast()); } xcb_randr_monitor_info_next(&monitor_iter); @@ -551,10 +553,8 @@ void QXcbConnection::initializeScreensFromMonitor(xcb_screen_iterator_t *it, int qCDebug(lcQpaScreen) << "create a fake screen: " << screen; } - if (primaryScreenNumber() == xcbScreenNumber) { - *primaryScreen = screen; - (*primaryScreen)->setPrimary(true); - } + *primaryScreen = screen; + (*primaryScreen)->setPrimary(true); siblings << screen; m_screens << screen; -- cgit v1.2.3