summaryrefslogtreecommitdiffstats
path: root/kmilo/generic/generic_monitor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmilo/generic/generic_monitor.cpp')
-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);
}
}