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 <axel.spoerl@qt.io>
(cherry picked from commit 45b33133c1c4b6dbabd48fda1c68c25a400fd482)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Liang Qi 2024-11-26 15:30:27 +01:00 committed by Qt Cherry-pick Bot
parent e4495d8321
commit b63cceb1b0

View File

@ -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<QPlatformScreen*> old = virtualDesktop->m_screens;
QList<QPlatformScreen *> 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;