=== modified file 'src/gpm-brightness.c'
--- src/gpm-brightness.c	2010-09-20 15:40:50 +0000
+++ src/gpm-brightness.c	2010-11-06 14:06:50 +0000
@@ -57,6 +57,7 @@
 	gboolean		 cache_trusted;
 	guint			 cache_percentage;
 	guint			 last_set_hw;
+	guint			 actual;
 	Atom			 backlight;
 	Display			*dpy;
 	GdkWindow		*root_window;
@@ -479,32 +480,45 @@
 gpm_brightness_foreach_resource (GpmBrightness *brightness, GpmXRandROp op, XRRScreenResources *resources)
 {
 	gint i;
+	guint real;
 	gboolean ret;
 	gboolean success_any = FALSE;
 	RROutput output;
 
 	g_return_val_if_fail (GPM_IS_BRIGHTNESS (brightness), FALSE);
-
+		
 	/* do for each output */
 	for (i=0; i<resources->noutput; i++) {
 		output = resources->outputs[i];
 		egg_debug ("resource %i of %i", i+1, resources->noutput);
-		if (op==ACTION_BACKLIGHT_GET) {
-			ret = gpm_brightness_output_get_percentage (brightness, output);
-		} else if (op==ACTION_BACKLIGHT_INC) {
-			ret = gpm_brightness_output_up (brightness, output);
-		} else if (op==ACTION_BACKLIGHT_DEC) {
-			ret = gpm_brightness_output_down (brightness, output);
-		} else if (op==ACTION_BACKLIGHT_SET) {
-			ret = gpm_brightness_output_set (brightness, output);
-		} else {
-			ret = FALSE;
-			egg_warning ("op not known");
-		}
-		if (ret) {
+		
+		/* get actual brightness */
+		ret = gpm_brightness_output_get_internal (brightness, output, &real);
+		
+		/* compare it with brightness before key pressing */
+		if (ret && brightness->priv->actual != real) {
+			brightness->priv->actual = real;
 			success_any = TRUE;
 		}
+		else {
+			if (op==ACTION_BACKLIGHT_GET) {
+				ret = gpm_brightness_output_get_percentage (brightness, output);
+			} else if (op==ACTION_BACKLIGHT_INC) {
+				ret = gpm_brightness_output_up (brightness, output);
+			} else if (op==ACTION_BACKLIGHT_DEC) {
+				ret = gpm_brightness_output_down (brightness, output);
+			} else if (op==ACTION_BACKLIGHT_SET) {
+				ret = gpm_brightness_output_set (brightness, output);
+			} else {
+				ret = FALSE;
+				egg_warning ("op not known");
+			}
+			if (ret) {
+				success_any = TRUE;
+			}
+		}
 	}
+
 	return success_any;
 }
 
@@ -526,10 +540,6 @@
 	if (!brightness->priv->has_extension)
 		return FALSE;
 
-	/* Return immediately if we can't use XRandR */
-	if (!brightness->priv->has_extension)
-		return FALSE;
-
 	/* do for each screen */
 	length = brightness->priv->resources->len;
 	for (i=0; i<length; i++) {
@@ -947,6 +957,7 @@
 	brightness->priv->hw_changed = FALSE;
 	brightness->priv->extension_levels = -1;
 	brightness->priv->resources = g_ptr_array_new_with_free_func ((GDestroyNotify) XRRFreeScreenResources);
+	brightness->priv->actual = gpm_brightness_helper_get_value ("get-brightness"); /* get actual brightness and store it */
 
 	/* can we do this */
 	brightness->priv->has_extension = gpm_brightness_setup_display (brightness);
@@ -998,4 +1009,3 @@
 	}
 	return GPM_BRIGHTNESS (gpm_brightness_object);
 }
-

