summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2015-07-05 12:15:29 +0200
committerShawn Rutledge <shawn.rutledge@theqtcompany.com>2015-07-22 12:10:11 +0000
commitb0b08cc0e4e38504d6b833702f7477aee4e2a192 (patch)
treeaa59e3d86a2df22352f0abb3e1346da463583509
parent99e0fbbe1fb82163fd7bcd6b3d4895c97009854d (diff)
When a screen comes back online, the windows need to be told about it
On my system, this fixes the misbehavior of Qt applications when the (only) active screen is switched, e.g. from an external screen to the laptop. This behavior is caused by the screen() of widgets to be set to NULL when their screen goes away. When a new screen comes online, the widgets *should* be told about it, but they are not. The only place that "maybeSetScreen" is called is when an existing screen changes its geometry, but not when a screen gets enabled without its geometry being affected in any way (e.g. because it was just disabled via xrandr, but has been connected all along). This makes sure that "maybeSetScreen" is also called when a screen gets enabled. Task-number: QTBUG-47041 Change-Id: Ic72d6beaa544bf9a4efdbea0830b1bc0d6ce5362 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 74f48b0136..08676152dc 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -252,6 +252,14 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
otherScreen->addVirtualSibling(screen);
m_screens << screen;
QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary());
+
+ // Windows which had null screens have already had expose events by now.
+ // They need to be told the screen is back, it's OK to render.
+ foreach (QWindow *window, QGuiApplication::topLevelWindows()) {
+ QXcbWindow *xcbWin = static_cast<QXcbWindow*>(window->handle());
+ if (xcbWin)
+ xcbWin->maybeSetScreen(screen);
+ }
}
// else ignore disabled screens
} else if (screen) {