summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbconnection.cpp
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2015-09-04 16:52:04 +0200
committerAleix Pol Gonzalez <aleixpol@kde.org>2015-09-08 08:16:51 +0000
commit8cbaea441a8c9adea6ba804b76bf3bd1e79f77b7 (patch)
tree82cba3c4f6b40066beffb87ff0a8b8514378c7a3 /src/plugins/platforms/xcb/qxcbconnection.cpp
parentfd2067b67bc2da7d7ee53ca2cadc9f6b81971fc0 (diff)
Notify when the primary screen changes
Makes it possible to notify that the QGuiApplication::primaryScreen has changed. XCB backend adopts the new API, as it was accessing QGuiApplication private API directly. Change-Id: Icde05c44138265f865fa42d2cd6974c552fdc5e2 Task-number: QTBUG-38404 Task-number: QTBUG-40659 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index e612cff9a3..5fd0df54d8 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -305,13 +305,10 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
screen->updateRefreshRate(output.mode);
// If the screen became primary, reshuffle the order in QGuiApplicationPrivate
- // TODO: add a proper mechanism for updating primary screen
if (!wasPrimary && screen->isPrimary()) {
- QScreen *realScreen = static_cast<QPlatformScreen*>(screen)->screen();
- QGuiApplicationPrivate::screen_list.removeOne(realScreen);
- QGuiApplicationPrivate::screen_list.prepend(realScreen);
- m_screens.removeOne(screen);
- m_screens.prepend(screen);
+ const int idx = m_screens.indexOf(screen);
+ m_screens.swap(0, idx);
+ QXcbIntegration::instance()->setPrimaryScreen(screen);
}
qCDebug(lcQpaScreen) << "output has changed" << screen;
}