diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-08-23 13:11:57 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-08-23 18:06:40 +0900 |
commit | 431f2c2113833b3ca45b114fbb6f64e3db16583e (patch) | |
tree | cc539596d61e40609bcd0dc0a15a99dba9c1edb4 | |
parent | 1ef07aa28d132e4b961d1679376d06ffb7876404 (diff) | |
download | tdepowersave-431f2c2113833b3ca45b114fbb6f64e3db16583e.tar.gz tdepowersave-431f2c2113833b3ca45b114fbb6f64e3db16583e.zip |
Fix value returned by 'brightnessGet' DCOP call. The value is now in the range 0-100 (percentage) or -1 if brightness is not supported
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 8d7b59182699760823b0997412039ee3cbdb346f)
-rw-r--r-- | src/tdepowersave.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tdepowersave.cpp b/src/tdepowersave.cpp index 4db6039..2cbc837 100644 --- a/src/tdepowersave.cpp +++ b/src/tdepowersave.cpp @@ -2938,7 +2938,7 @@ int tdepowersave::brightnessGet() { int retval = -1; if (hwinfo->supportBrightness()) { - retval = (int)(((float)hwinfo->getCurrentBrightnessLevel() / (float)hwinfo->getMaxBrightnessLevel()-1) * 100.0); + retval = (int)(100.0 * hwinfo->getCurrentBrightnessLevel() / hwinfo->getMaxBrightnessLevel()); } kdDebugFuncOut(trace); |