Commit a559aefb authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen Committed by Nate Graham
Browse files

Always extend out from the current primary screen

If no screen is embedded find the current primary screen and pretend
that is embedded. This fixes extend left/right to extend that way from
the current screen instead of relative to whatever screen randomly comes
first in an internal datastructure.

(cherry picked from commit e2f4f139)
parent 7cc32a75
Pipeline #241971 canceled with stage
......@@ -164,10 +164,19 @@ KScreen::ConfigPtr Generator::displaySwitch(DisplaySwitchAction action)
KScreen::OutputPtr embedded, external;
embedded = embeddedOutput(connectedOutputs);
// If we don't have an embedded output (desktop with two external screens
// for instance), then pretend one of them is embedded
// for instance), then pretend the current primary one is embedded
if (!embedded) {
const auto &firstConnectedOutputKey = connectedOutputs.constBegin().key();
embedded = connectedOutputs.value(firstConnectedOutputKey);
// Find primary screen
for (auto &screen : connectedOutputs) {
if (screen->isPrimary()) {
embedded = screen;
if (!embedded) {
// If all else fail take the first screen
embedded = connectedOutputs.constBegin().value();
// Just to be sure
if (embedded->modes().isEmpty()) {
......@@ -182,8 +191,7 @@ KScreen::ConfigPtr Generator::displaySwitch(DisplaySwitchAction action)
const auto firstConnectedOutputKey = connectedOutputs.constBegin().key();
external = connectedOutputs.value(firstConnectedOutputKey);
external = connectedOutputs.constBegin().value();
// Just to be sure
if (external->modes().isEmpty()) {
return config;
Supports Markdown
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