gnome-power-manager r3194 - in branches/gnome-2-24: . src



Author: rhughes
Date: Wed Jan 28 08:42:29 2009
New Revision: 3194
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3194&view=rev

Log:
2009-01-28  Richard Hughes  <richard hughsie com>

* src/gpm-brightness-xrandr.c: (gpm_brightness_xrandr_output_down):
When the minimum reported brightness is not zero don't wraparound 0
when we try to step down a large number of brightness levels.
Instead truncate to the minimum to fix a hang.
Fixes #569100
Patch from Fortunato Ventre, many thanks.


Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/src/gpm-brightness-xrandr.c

Modified: branches/gnome-2-24/src/gpm-brightness-xrandr.c
==============================================================================
--- branches/gnome-2-24/src/gpm-brightness-xrandr.c	(original)
+++ branches/gnome-2-24/src/gpm-brightness-xrandr.c	Wed Jan 28 08:42:29 2009
@@ -234,6 +234,7 @@
 gpm_brightness_xrandr_output_down (GpmBrightnessXRandR *brightness, RROutput output)
 {
 	guint cur;
+	guint step;
 	gboolean ret;
 	guint min, max;
 
@@ -252,10 +253,12 @@
 		egg_debug ("already min");
 		return TRUE;
 	}
-	cur -= gpm_brightness_get_step ((max-min)+1);
-	if (cur < min) {
+	step = gpm_brightness_get_step ((max-min)+1);
+	if (cur < step) {
 		egg_debug ("truncating to %i", min);
 		cur = min;
+	} else {
+		cur -= step;
 	}
 	ret = gpm_brightness_xrandr_output_set_internal (brightness, output, cur);
 	return ret;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]