summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2023-02-24 15:53:19 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-24 12:25:52 +0000
commitc8e20cbde5a4c85f56567574040dda5450ba27da (patch)
tree477fd604b53df3f903d2a76dfe5e06c3f3e2c2c2
parent2dc7cbfd272e6678a2b78149826a0ae52cf77df7 (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. 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> (cherry picked from commit 2b94453cbdab5c691c830ff539e81408d5330e3b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-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 9e44a322a2..9e8117153c 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;
@@ -522,14 +526,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);
@@ -552,10 +554,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;