aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp')
-rw-r--r--src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp31
1 files changed, 12 insertions, 19 deletions
diff --git a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp
index 13ed86f4..9bad91db 100644
--- a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp
+++ b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp
@@ -21,34 +21,26 @@ void RRSettings::ApplyPrevious(){
QString primary;
QStringList avail;
for(int i=0; i<screens.length(); i++){
- //if(screens[i].order>=0){screens[i].order = -1; } //reset all screen orders (need to re-check all)
if(devs.contains(screens[i].ID) && screens[i].isavailable){ //only load settings for monitors which are currently attached
set.beginGroup(screens[i].ID);
screens[i].geom = set.value("geometry", QRect()).toRect();
screens[i].isprimary = set.value("isprimary", false).toBool();
if(screens[i].isprimary){ primary = screens[i].ID; }
- screens[i].isactive = lastactive.contains(screens[i].ID);
- screens[i].order = (screens[i].isactive ? -1 : -3); //check/ignore
+ screens[i].applyChange = (screens[i].isactive && !lastactive.contains(screens[i].ID) ? 1 : 0); //disable/ignore
screens[i].rotation = set.value("rotation",0).toInt();
set.endGroup();
- }else if(screens[i].isavailable){
- screens[i].order = -2; //needs activation/placement
- }else{
- screens[i].order = -3; //ignored
+ }else if(screens[i].isactive){
+ screens[i].applyChange = 1; //disable monitor - not enabled in the default settings
}
- //Now clean up the list as needed
- if(screens[i].order < -2){ screens.removeAt(i); i--; } //just remove it (less to loop through later)
- else{ avail << screens[i].ID; } //needed for some checks later - make it simple
}
- //NOTE ABOUT orders: -1: check geom, -2: auto-add to end, -3: ignored
//Quick checks for simple systems - just use current X config as-is
if(devs.isEmpty() && (avail.filter("LVDS").isEmpty() || screens.length()==1) ){ return; }
//Typical ID's: LVDS-[], DVI-I-[], DP-[], HDMI-[], VGA-[]
- //"LVDS" is the built-in laptop display normally
+ //"LVDS" or "eDP" is the built-in laptop display normally
if(primary.isEmpty()){
- QStringList priority; priority << "LVDS" << "DP" << "HDMI" << "DVI" << "VGA";
+ QStringList priority; priority << "LVDS" << "eDP" << "DP" << "HDMI" << "DVI" << "VGA";
for(int i=0; i<priority.length() && primary.isEmpty(); i++){
QStringList filter = avail.filter(priority[i]);
if(!filter.isEmpty()){ filter.sort(); primary = filter.first(); }
@@ -58,10 +50,10 @@ void RRSettings::ApplyPrevious(){
//Ensure only one monitor is primary, and reset a few flags
for(int i=0; i<screens.length(); i++){
if(screens[i].ID!=primary){ screens[i].isprimary = false; }
- screens[i].isactive = true; //we want all these monitors to be active eventually
+ //screens[i].isactive = true; //we want all these monitors to be active eventually
}
// Handle all the available monitors
- int handled = 0;
+ /*int handled = 0;
int cx = 0; //current x point
while(handled<screens.length()){
//Go through horizontally and place monitors (TO-DO: Vertical placement not handled yet)
@@ -94,7 +86,7 @@ void RRSettings::ApplyPrevious(){
qDebug() << "Unhandled Monitors:" << screens.length()-handled;
break;
}
- }
+ }*/
//Now reset the display with xrandr
RRSettings::Apply(screens);
}
@@ -144,7 +136,7 @@ QList<ScreenInfo> RRSettings::CurrentScreens(){
//Device that is connected, but not attached
qDebug() << "Create new Screen entry:" << dev << "none";
cscreen.ID = dev;
- cscreen.order = -2; //flag this right now as a non-active screen
+ //cscreen.order = -2; //flag this right now as a non-active screen
cscreen.isavailable = true;
cscreen.isactive = false;
}
@@ -188,8 +180,9 @@ void RRSettings::Apply(QList<ScreenInfo> screens){
QStringList opts;
//qDebug() << "Apply:" << screens.length();
for(int i=0; i<screens.length(); i++){
- qDebug() << " -- Screen:" << i << screens[i].ID << screens[i].isactive << screens[i].order;
- if(screens[i].order <0 || !screens[i].isactive){ continue; } //skip this screen - non-active
+ qDebug() << " -- Screen:" << i << screens[i].ID << screens[i].isactive;
+ if(screens[i].applyChange <=0 || !screens[i].isactive){ continue; } //skip this screen - non-active
+ else if(screens[i].applyChange==1){ opts << "--output" << screens[i].ID << "--off"; continue; } //deactivate a screen
opts << "--output" << screens[i].ID << "--mode" << QString::number(screens[i].geom.width())+"x"+QString::number(screens[i].geom.height());
opts << "--pos" << QString::number(screens[i].geom.x())+"x"+QString::number(screens[i].geom.y());
if(screens[i].rotation==-90){ opts << "--rotate" << "left"; }
bgstack15