[PATCH xbacklight 1/2] Properly round the new brightness value

Roman Donchenko dpb at corrigendum.ru
Tue Apr 2 13:09:20 PDT 2013


Previously, it was always rounded down, which meant that -dec X would
result in a bigger change than -inc X for the same X if rounding took place.

Signed-off-by: Roman Donchenko <dpb at corrigendum.ru>
---
 xbacklight.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xbacklight.c b/xbacklight.c
index 2189095..c054d26 100644
--- a/xbacklight.c
+++ b/xbacklight.c
@@ -309,7 +309,7 @@ main (int argc, char **argv)
 				cur = new;
 			    else
 				cur += step;
-			    backlight_set (conn, output, (long) cur);
+			    backlight_set (conn, output, (long) (cur + 0.5));
 			    xcb_flush (conn);
 			    usleep (total_time * 1000 / steps);
 			}
-- 
1.8.1.4



More information about the xorg-devel mailing list