Commit 7d1f6fd7 authored by Àlex Fiestas's avatar Àlex Fiestas
Browse files

If no connected outputs are found, do nothing

Our name is kscreen, we can handle dozens of configurations but we can't
handle having no screens (facepalm). This fixes that.

BUG:318936
parent d4b93be3
......@@ -70,6 +70,11 @@ KScreen::Config* Generator::idealConfig()
KScreen::OutputList outputs = config->connectedOutputs();
kDebug() << "Connected outputs: " << outputs.count();
if (outputs.isEmpty()) {
return config;
}
if (outputs.count() == 1) {
singleOutput(outputs);
return config;
......
{
"screen" :
{
"id" : 1,
"maxSize" : {
"width" : 8192,
"height" : 8192
},
"minSize" : {
"width" : 320,
"height" : 200
},
"currentSize" : {
"width" : 3200,
"height" : 1880
}
},
"outputs" :
[
{
"id" : 1,
"name" : "VGA1",
"type" : "VGA",
"modes" :
[
{
"id" : 3,
"name" : "1920x1080",
"refreshRate" : 59.9,
"size" : {
"width" : 1920,
"height" : 1080
}
},
{
"id" : 2,
"name" : "1600x1200",
"refreshRate" : 59.9,
"size" : {
"width" : 1600,
"height" : 1200
}
},
{
"id" : 1,
"name" : "800x600",
"refreshRate" : 60,
"size" : {
"width" : 800,
"height" : 600
}
}
],
"pos" : {
"x" : 0,
"y" : 0
},
"currentMode" : 3,
"preferredModes" : [3],
"rotation" : 1,
"connected" : false,
"enabled" : true,
"primary" : true,
"edid" : "AP///////wBMLcMFMzJGRQkUAQMOMx14Ku6Ro1RMmSYPUFQjCACBAIFAgYCVAKlAswABAQEBAjqAGHE4LUBYLEUA/h8RAAAeAAAA/QA4PB5REQAKICAgICAgAAAA/ABTeW5jTWFzdGVyCiAgAAAA/wBIOU1aMzAyMTk2CiAgAC4="
},
{
"id" : 2,
"name" : "HDMI2",
"type" : "HDMI",
"modes" :
[
{
"id" : 3,
"name" : "1920x1080",
"refreshRate" : 60,
"size" : {
"width" : 1920,
"height" : 1080
}
},
{
"id" : 2,
"name" : "1024x768",
"refreshRate" : 59.9,
"size" : {
"width" : 1024,
"height" : 768
}
},
{
"id" : 1,
"name" : "800x600",
"refreshRate" : 59.9,
"size" : {
"width" : 800,
"height" : 600
}
}
],
"pos" : {
"x" : 1280,
"y" : 0
},
"preferredModes" : [3],
"rotation" : 1,
"connected" : false,
"enabled" : true,
"primary" : false,
"edid" : "AP///////wAQrBbwTExLQQ4WAQOANCB46h7Frk80sSYOUFSlSwCBgKlA0QBxTwEBAQEBAQEBKDyAoHCwI0AwIDYABkQhAAAaAAAA/wBGNTI1TTI0NUFLTEwKAAAA/ABERUxMIFUyNDEwCiAgAAAA/QA4TB5REQAKICAgICAgAToCAynxUJAFBAMCBxYBHxITFCAVEQYjCQcHZwMMABAAOC2DAQAA4wUDAQI6gBhxOC1AWCxFAAZEIQAAHgEdgBhxHBYgWCwlAAZEIQAAngEdAHJR0B4gbihVAAZEIQAAHowK0Iog4C0QED6WAAZEIQAAGAAAAAAAAAAAAAAAAAAAPg=="
}
]
}
\ No newline at end of file
{
"screen" :
{
"id" : 1,
"maxSize" : {
"width" : 8192,
"height" : 8192
},
"minSize" : {
"width" : 320,
"height" : 200
},
"currentSize" : {
"width" : 3200,
"height" : 1880
}
},
"outputs" : [ ]
}
\ No newline at end of file
......@@ -41,6 +41,8 @@ private Q_SLOTS:
void laptopLidClosedAndThreeExternal();
void laptopDockedLidOpenAndExternal();
void laptopDockedLidClosedAndExternal();
void workstationWithoutScreens();
void workstationWithNoConnectedScreens();
void workstationTwoExternalSameSize();
void workstationTwoExternalDiferentSize();
......@@ -222,6 +224,34 @@ void testScreenConfig::laptopDockedLidClosedAndExternal()
QCOMPARE(external->pos(), QPoint(0, 0));
}
void testScreenConfig::workstationWithoutScreens()
{
loadConfig("workstationWithoutScreens.json");
Generator* generator = Generator::self();
generator->setForceLaptop(false);
Config* config = generator->idealConfig();
QVERIFY(config->outputs().isEmpty());
}
void testScreenConfig::workstationWithNoConnectedScreens()
{
loadConfig("workstationWithNoConnectedScreens.json");
Generator* generator = Generator::self();
generator->setForceLaptop(false);
Config* config = generator->idealConfig();
Output* external1 = config->output(1);
Output* external2 = config->output(2);
QCOMPARE(external1->isEnabled(), false);
QCOMPARE(external2->isEnabled(), false);
}
void testScreenConfig::workstationTwoExternalSameSize()
{
loadConfig("workstaionTwoExternalSameSize.json");
......
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