Commit ea19f9b6 authored by Robert Hoffmann's avatar Robert Hoffmann Committed by Nate Graham

Fix setting primary connector if primary output changed

Summary:
If a user logged in with one screen connected plugs in
a second screen, which becomes the new primary screen,
this screen would stay black or behave weird.

Unplugging the screen again would mess up plasmashell.

Added to ScreenPool::setPrimaryConnector():
In the case primary output changed m_idForConnector
doesn't contain the new primary, so a screen mapping
is created for it.

Test Plan:
Testing on virtualbox or vmware player seems impossible, because
these don't allow disabling the first display (VGA-1) and booting
with the second (VGA-2) only.

1. Boot machine with one screen connected to HDMI-3 (primary output).
2. Log in
3. Plug in second screen to HDMI-2:
--> primary output changes from HDMI-3 to HDMI-2
4. OSD appears: extend to right
--> Without this patch, the new screen (HDMI-2) would stay blank.
--> With this patch applied, the screen content moves to the new
   second screen.

5. Unplug second screen (HDMI-2)
--> Without this patch, the background would get black, control panel
   would disappear, could only be restored by restart of plasmashell
--> With this patch applied, screen content moves to the right and
   works

Reviewers: #plasma, mart, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D13853
parent 26050397
......@@ -105,9 +105,17 @@ void ScreenPool::setPrimaryConnector(const QString &primary)
if (m_primaryConnector == primary) {
return;
}
Q_ASSERT(m_idForConnector.contains(primary));
int oldIdForPrimary = m_idForConnector.value(primary);
int oldIdForPrimary = -1;
if (m_idForConnector.contains(primary)) {
oldIdForPrimary = m_idForConnector.value(primary);
}
if (oldIdForPrimary == -1) {
// move old primary to new free id
oldIdForPrimary = firstAvailableId();
insertScreenMapping(oldIdForPrimary, m_primaryConnector);
}
m_idForConnector[primary] = 0;
m_connectorForId[0] = primary;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment