From 8d7b59182699760823b0997412039ee3cbdb346f Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 23 Aug 2023 13:11:57 +0900 Subject: 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 --- src/tdepowersave.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tdepowersave.cpp') 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); -- cgit v1.2.1