diff options
authorDavid Fries <>2014-03-04 00:33:29 -0600
committerThe Qt Project <>2014-03-29 21:23:03 +0100
commit24ac9f518d382dc1a780f4eb80e5703637e557d2 (patch)
parent51d4eb8f5ba769cd50457b2f479acc3f30b9f78f (diff)
XCB: use requested primary screen DISPLAY=:0.1 when possible
The current logic requires primary->output to not be specified, or match the output number. This fails when the output by that number doesn't currently have a display attached, as non-connected outputs are skipped. This means setting the display to :0.1 for Qt5 will put the window on :0.0 and it can't be moved to :0.1 after the fact. The solution is to pick the first output on the requested screen, then override if an output exactly matches the primary output value. That way it will at least be on the requested screen. Tested with Xephyr, ATI, and nVidia (proprietary driver), where the nVidia had the primary output disconnected. Task-number: QTBUG-15418 Change-Id: I7951dcef74cb135dc12a6e133a71c5852eae9778 Reviewed-by: Uli Schlachter <> Reviewed-by: Shawn Rutledge <>
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 5f396e0946..66b8401ea2 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -185,8 +185,12 @@ void QXcbConnection::updateScreens()
siblings << screen;
activeScreens << screen;
- if (!primaryScreen && primary) {
- if (m_primaryScreen == xcbScreenNumber && (primary->output == XCB_NONE || outputs[i] == primary->output)) {
+ // There can be multiple outputs per screen, use either
+ // the first or an exact match. An exact match isn't
+ // always available if primary->output is XCB_NONE
+ // or currently disconnected output.
+ if (m_primaryScreen == xcbScreenNumber) {
+ if (!primaryScreen || (primary && outputs[i] == primary->output)) {
primaryScreen = screen;
#ifdef Q_XCB_DEBUG