Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.5.1
-
None
-
Ubuntu Xenial, qtbase-opensource-src-5.5.1
Description
Hi,
Recently I was investigating a bug in KDE Plasma (https://bugs.kde.org/show_bug.cgi?id=350994) and found that in some cases QScreen object may change its name, though it is marked as read-only and doesn't have a signal to know about the change.
This happens when one monitor is disconnected and another is connected (happens on my computer when it goes to idle state and switches off external monitor, thus switching on internal one). The problem is that Plasma relies on the fact that name cannot change.
I found that the change of name happens in QXcbScreen::setOutput, which is called when screen is converted to "fake" screen (it is renamed to something like ":0.0") and vice versa (back to HDMI1/eDP1/etc).
Also if you look at the code of QXcbScreen::setOutput, you may see this line:
// TODO: Send an event to the QScreen instance that the screen changed its name
Since I'm not very familiar with code of Qt, I didn't go with big changes converting QScreen::name to read-write property and addding appropriate signal for its change (also it would require changes in Plasma itself).
But I chose another way - to emit "screenRemoved" signal when screen becomes "fake" and then emit "screenAdded" signal when it becomes real. Makes sense. And fixes the problem.
So I'm attaching the patch for you to review and test. It is based on Qt 5.5.1 opensource version (tarball from Ubuntu package sources).
Also I applied the patch to ubuntu packages and made ppa with the fix, if you want to quickly test it (only ubuntu-xenial): https://launchpad.net/~xapienz/+archive/ubuntu/ppa
Attachments
Issue Links
- relates to
-
QTBUG-94940 QGuiApplication::primaryScreenChanged() signal not working under X11
-
- Open
-
Gerrit Reviews
For Gerrit Dashboard: QTBUG-52375 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
338793,1 | Send an event to the QScreen instance that the screen changed its name | dev | qt/qtbase | Status: ABANDONED | -1 | 0 |