diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-08-23 13:17:05 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-08-23 13:17:05 +0900 |
commit | ae4a3892ffe9abb2f3b0b1c5612282886b1e9c40 (patch) | |
tree | a12dbfc36080326352e3d8f8ff15a0d7570e94b3 /kmilo | |
parent | 2c7c646af5349a9a68c2f129fda7af338855ba85 (diff) | |
download | tdeutils-ae4a3892ffe9abb2f3b0b1c5612282886b1e9c40.tar.gz tdeutils-ae4a3892ffe9abb2f3b0b1c5612282886b1e9c40.zip |
Adjust brightness control to the corrected 'brightnessGet' DCOP call in tdepowersave
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'kmilo')
-rw-r--r-- | kmilo/generic/generic_monitor.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/kmilo/generic/generic_monitor.cpp b/kmilo/generic/generic_monitor.cpp index 739b266..5751037 100644 --- a/kmilo/generic/generic_monitor.cpp +++ b/kmilo/generic/generic_monitor.cpp @@ -283,25 +283,28 @@ void GenericMonitor::brightnessChange(int direction, int step) DCOPReply reply = tdepowersave->call("brightnessGet"); if (reply.isValid()) { - int brightnessLevel = 100 + (int)reply; // reply value is a negative number between 0 and -100. - brightnessLevel += direction * step; // add requested brightness step - if (brightnessLevel > 100) + int brightnessLevel = (int)reply; + if (brightnessLevel >= 0) { - brightnessLevel = 100; + brightnessLevel += direction * step; // add requested brightness step + if (brightnessLevel > 100) + { + brightnessLevel = 100; + } + if (brightnessLevel < 0) + { + brightnessLevel = 0; + } + if (direction > 0) + { + tdepowersave->send("do_brightnessUp", step); + } + else if (direction < 0) + { + tdepowersave->send("do_brightnessDown", step); + } + _interface->displayProgress(i18n("Brightness"), brightnessLevel); } - if (brightnessLevel < 0) - { - brightnessLevel = 0; - } - if (direction > 0) - { - tdepowersave->send("do_brightnessUp", step); - } - else if (direction < 0) - { - tdepowersave->send("do_brightnessDown", step); - } - _interface->displayProgress(i18n("Brightness"), brightnessLevel); } } |