summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-08-23 13:17:05 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-08-23 18:08:58 +0900
commitce41d2a78054724fc7afda084d6a9e1ff1fef699 (patch)
tree0d73010ad5502b658ec6aeeb5fdf89176c8df5d5
parentf5f1b89f8bda3b5d5f57255b04da3a7626154e58 (diff)
downloadtdeutils-ce41d2a78054724fc7afda084d6a9e1ff1fef699.tar.gz
tdeutils-ce41d2a78054724fc7afda084d6a9e1ff1fef699.zip
Adjust brightness control to the corrected 'brightnessGet' DCOP call in tdepowersave
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit ae4a3892ffe9abb2f3b0b1c5612282886b1e9c40)
-rw-r--r--kmilo/generic/generic_monitor.cpp37
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);
}
}