~kamalmostafa/ubuntu/oneiric/gnome-settings-daemon/bug-827517

« back to all changes in this revision

Viewing changes to debian/patches/50_fix_brightness_step.patch

  • Committer: Kamal Mostafa
  • Author(s): Kamal Mostafa
  • Date: 2011-08-16 21:04:36 UTC
  • Revision ID: kamal@whence.com-20110816210436-kixv7eu4w3d8n7s0
* debian/patches/50_fix_brightness_step.patch
  - fix the broken BRIGHTNESS_STEP_AMOUNT macro (LP: #827517)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: fix BRIGHTESS_STEP_AMOUNT calculation macro
 
2
Author: Kamal Mostafa <kamal@canonical.com>
 
3
Bug-Ubuntu: https://launchpad.net/bugs/827517
 
4
 
 
5
The BRIGHTNESS_STEP_AMOUNT macro calculates a bogus value when called
 
6
as BRIGHTNESS_STEP_AMOUNT(max - min + 1) due to missing parentheses.
 
7
 
 
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[] =
 
11
 "</node>";
 
12
 
 
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)
 
16
 
 
17
 /* take a discrete value with offset and convert to percentage */
 
18
 #define ABS_TO_PERCENTAGE(min, max, value) (((value - min) * 100) / (max - min))