When a screen comes back online, the windows need to be told about it (QTBUG-47041)

This commit is contained in:
Rex Dieter 2015-10-05 11:55:06 -05:00
parent eed09bb685
commit 19c78c8b79
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From b0b08cc0e4e38504d6b833702f7477aee4e2a192 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Sun, 5 Jul 2015 12:15:29 +0200
Subject: [PATCH] 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>
---
src/plugins/platforms/xcb/qxcbconnection.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 74f48b0..0867615 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) {
--
2.3.5

View File

@ -44,7 +44,7 @@
Summary: Qt5 - QtBase components
Name: qt5-qtbase
Version: 5.5.0
Release: 17%{?dist}
Release: 18%{?dist}
# See LGPL_EXCEPTIONS.txt, for exception details
License: LGPLv2 with exceptions or GPLv3 with exceptions
@ -108,6 +108,10 @@ Patch53: qtbase-opensource-src-5.4.1-QTBUG-45484.patch
# 'make docs' crash on el6, use qSort instead of std::sort
Patch100: qtbase-opensource-src-5.4.0-QTBUG-43057.patch
# https://codereview.qt-project.org/#/c/120700/
# http://bugreports.qt.io/browse/QTBUG-47041
Patch101: qt5-qtbase-QTBUG-47041.patch
# https://bugreports.qt.io/browse/QTBUG-46310
#SM_CLIENT_ID property is not set
Patch223: 0123-xcb-set-SM_CLIENT_ID-property.patch
@ -385,6 +389,7 @@ rm -fv mkspecs/linux-g++*/qmake.conf.multilib-optflags
%if 0%{?rhel} == 6
%patch100 -p1 -b .QTBUG-43057
%endif
%patch101 -p1 -b .QTBUG-47041
%patch155 -p1 -b .0055
%patch223 -p1 -b .QTBUG-46310
@ -943,6 +948,9 @@ fi
%changelog
* Mon Oct 05 2015 Rex Dieter <rdieter@fedoraproject.org> 5.5.0-18
- When a screen comes back online, the windows need to be told about it (QTBUG-47041)
* Wed Aug 19 2015 Rex Dieter <rdieter@fedoraproject.org> 5.5.0-17
- unconditionally undo valgrind hack when done (#1255054)