summaryrefslogtreecommitdiffstats
path: root/kmilo
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 13:17:05 +0900
commitae4a3892ffe9abb2f3b0b1c5612282886b1e9c40 (patch)
treea12dbfc36080326352e3d8f8ff15a0d7570e94b3 /kmilo
parent2c7c646af5349a9a68c2f129fda7af338855ba85 (diff)
downloadtdeutils-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.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);
}
}