diff options
author | Ken Moore <ken@ixsystems.com> | 2017-09-21 13:13:27 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-09-21 13:13:27 -0400 |
commit | 44d9434c1ebaed00834dcb9ba0aeb8f5af2c41cb (patch) | |
tree | f3621dbe35db95325c060b3848b17eeaa4c4d7ba /src-qt5/core-utils | |
parent | Merge branch 'master' of github.com:trueos/lumina (diff) | |
download | lumina-44d9434c1ebaed00834dcb9ba0aeb8f5af2c41cb.tar.gz lumina-44d9434c1ebaed00834dcb9ba0aeb8f5af2c41cb.tar.bz2 lumina-44d9434c1ebaed00834dcb9ba0aeb8f5af2c41cb.zip |
Add a few quick safety checks to ensure that lumina-xconfig never disables the last active screen.
Diffstat (limited to 'src-qt5/core-utils')
-rw-r--r-- | src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp index 3c0edc76..a9d40554 100644 --- a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp +++ b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp @@ -13,6 +13,7 @@ void RRSettings::ApplyPrevious(){ QList<ScreenInfo> screens; QSettings set("lumina-desktop","lumina-xconfig"); + if(set.allKeys().isEmpty()){ return; } QString profile = set.value("default_profile","").toString(); if(profile.isEmpty() || !savedProfiles().contains(profile) ){ screens = PreviousSettings(); } else{ screens = PreviousSettings(profile); } @@ -167,6 +168,13 @@ bool RRSettings::SaveScreens(QList<ScreenInfo> screens, QString profile){ //Apply screen configuration void RRSettings::Apply(QList<ScreenInfo> screens){ + //Verify that there is at least 1 active/enabled monitor first + bool foundactive = false; + for(int i=0; i<screens.length() && !foundactive; i++){ + if(screens[i].isactive){ foundactive = (screens[i].applyChange!=1); } //make sure we are not turning it off + else{ foundactive = (screens[i].applyChange==2); } + } + if(!foundactive){ return; } //never disable all screens //Read all the settings and create the xrandr options to maintain these settings QStringList opts; //qDebug() << "Apply:" << screens.length(); |