summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2023-02-24 15:53:19 +0100
committerLiang Qi <liang.qi@qt.io>2023-03-03 07:42:21 +0000
commit2b94453cbdab5c691c830ff539e81408d5330e3b (patch)
treed447a8048d332cdd3ea55acea8f298a70559278e /src/plugins/platforms/xcb
parenta53429c1ecbd50ac2e4ecd4ab2c6b245a6b2b99f (diff)
xcb: ignore the xscreens which don't belong to current connection
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ø <tor.arne.vestbo@qt.io> Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_screens.cpp24
1 files changed, 12 insertions, 12 deletions
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<QPlatformScreen*> old = virtualDesktop->m_screens;
QList<QPlatformScreen *> 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;