1
Description: fix BRIGHTESS_STEP_AMOUNT calculation macro
2
Author: Kamal Mostafa <kamal@canonical.com>
3
Bug-Ubuntu: https://launchpad.net/bugs/827517
5
The BRIGHTNESS_STEP_AMOUNT macro calculates a bogus value when called
6
as BRIGHTNESS_STEP_AMOUNT(max - min + 1) due to missing parentheses.
8
--- gnome-settings-daemon-3.1.4.orig/plugins/power/gsd-power-manager.c
9
+++ gnome-settings-daemon-3.1.4/plugins/power/gsd-power-manager.c
10
@@ -121,7 +121,7 @@ static const gchar introspection_xml[] =
13
/* on ACPI machines we have 4-16 levels, on others it's ~150 */
14
-#define BRIGHTNESS_STEP_AMOUNT(max) (max < 20 ? 1 : max / 20)
15
+#define BRIGHTNESS_STEP_AMOUNT(max) ((max) < 20 ? 1 : (max) / 20)
17
/* take a discrete value with offset and convert to percentage */
18
#define ABS_TO_PERCENTAGE(min, max, value) (((value - min) * 100) / (max - min))