From b63cceb1b00c725fb420c14aeda2a2ad5bd8aa47 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 26 Nov 2024 15:30:27 +0100 Subject: [PATCH] Revert "xcb: ignore the xscreens which don't belong to current connection" This reverts commit 2b94453cbdab5c691c830ff539e81408d5330e3b. This caused a crash when d&d text and etc cross xscreens from qt application. Pick-to: 6.5 Task-number: QTBUG-110898 Task-number: QTBUG-130714 Change-Id: Ie272ee96cdd963491bcf37f5448c3f4af3fd6aa7 Reviewed-by: Axel Spoerl (cherry picked from commit 45b33133c1c4b6dbabd48fda1c68c25a400fd482) Reviewed-by: Qt Cherry-pick Bot --- .../platforms/xcb/qxcbconnection_screens.cpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp index 3dbb8835422..cc1d9466d5e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp @@ -489,10 +489,6 @@ 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; @@ -525,12 +521,14 @@ void QXcbConnection::initializeScreensFromMonitor(xcb_screen_iterator_t *it, int siblings << screen; // similar logic with QXcbConnection::initializeScreensFromOutput() - if (!(*primaryScreen) || monitor_info->primary) { - if (*primaryScreen) - (*primaryScreen)->setPrimary(false); - *primaryScreen = screen; - (*primaryScreen)->setPrimary(true); - siblings.prepend(siblings.takeLast()); + if (primaryScreenNumber() == xcbScreenNumber) { + 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); @@ -553,8 +551,10 @@ void QXcbConnection::initializeScreensFromMonitor(xcb_screen_iterator_t *it, int qCDebug(lcQpaScreen) << "create a fake screen: " << screen; } - *primaryScreen = screen; - (*primaryScreen)->setPrimary(true); + if (primaryScreenNumber() == xcbScreenNumber) { + *primaryScreen = screen; + (*primaryScreen)->setPrimary(true); + } siblings << screen; m_screens << screen;