diff -ruN gnome-power-manager-2.22.1-debian-orig/debian/changelog gnome-power-manager-2.22.1/debian/changelog --- gnome-power-manager-2.22.1-debian-orig/debian/changelog 2010-04-09 00:34:18.000000000 -0400 +++ gnome-power-manager-2.22.1/debian/changelog 2010-04-09 00:32:43.000000000 -0400 @@ -1,3 +1,14 @@ +gnome-power-manager (2.22.1-4+metad1) metad; urgency=low + + * Backported backlight fix by Richard Hughes + from revision 2768 of upstream (2008-04-09), which makes the + backlight do what the user expects rather than what the policy + says. This fixes the bug where auto-dimming returns the level to + the policy value rather than the value the user just set using the + brightness applet or brightness keys. + + -- Mark H Weaver Fri, 09 Apr 2010 00:32:41 -0400 + gnome-power-manager (2.22.1-4) unstable; urgency=low * Rewrite description. Closes: #388109. diff -ruN gnome-power-manager-2.22.1-debian-orig/debian/patches/09-backlight-fix.patch gnome-power-manager-2.22.1/debian/patches/09-backlight-fix.patch --- gnome-power-manager-2.22.1-debian-orig/debian/patches/09-backlight-fix.patch 1969-12-31 19:00:00.000000000 -0500 +++ gnome-power-manager-2.22.1/debian/patches/09-backlight-fix.patch 2010-04-09 00:33:02.000000000 -0400 @@ -0,0 +1,165 @@ +--- ChangeLog.mhw1 2008-03-28 12:09:45.000000000 -0400 ++++ ChangeLog 2010-04-09 00:26:59.000000000 -0400 +@@ -1,3 +1,15 @@ ++2008-04-09 Richard Hughes ++ ++ * src/gpm-backlight.c: (gpm_backlight_get_brightness), ++ (gpm_backlight_set_brightness), ++ (gpm_backlight_brightness_evaluate_and_set), (conf_key_changed_cb), ++ (gpm_backlight_button_pressed_cb), (idle_changed_cb), ++ (gpm_backlight_init): ++ Make the backlight do what the user expects rather than what the policy says. ++ This should fix the bug where auto-dimming returns the level to the policy value ++ rather than the value the user just set using the brightness applet or brightness keys. ++ (backported by Mark H Weaver ) ++ + 2008-03-28 Richard Hughes + + ==== Version 2.22.1 ==== +--- src/gpm-backlight.c.mhw1 2008-03-10 17:49:46.000000000 -0400 ++++ src/gpm-backlight.c 2010-04-09 00:25:05.000000000 -0400 +@@ -81,6 +81,7 @@ + GTimer *idle_timer; + gfloat ambient_sensor_value; + guint idle_dim_timeout; ++ guint master_percentage; + }; + + enum { +@@ -304,6 +305,8 @@ + guint brightness, + GError **error) + { ++ gboolean ret; ++ + g_return_val_if_fail (backlight != NULL, FALSE); + g_return_val_if_fail (GPM_IS_BACKLIGHT (backlight), FALSE); + +@@ -316,9 +319,8 @@ + } + + /* just set the AC brightness for now, don't try to be clever */ +- gpm_conf_set_uint (backlight->priv->conf, GPM_CONF_BACKLIGHT_BRIGHTNESS_AC, brightness); +-#if 0 +- gboolean ret; ++ backlight->priv->master_percentage = brightness; ++ + /* sets the current policy brightness */ + ret = gpm_brightness_lcd_set_std (backlight->priv->brightness, brightness); + if (ret == FALSE) { +@@ -326,9 +328,7 @@ + GPM_BACKLIGHT_ERROR_GENERAL, + "Cannot set policy brightness"); + } +-#endif +- +- return TRUE; ++ return ret; + } + + /** +@@ -370,9 +370,8 @@ + return FALSE; + } + +- /* get the 'main' brightness */ +- gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_BACKLIGHT_BRIGHTNESS_AC, &value); +- brightness = value / 100.0f; ++ /* get the last set brightness */ ++ brightness = backlight->priv->master_percentage / 100.0f; + gpm_debug ("1. main brightness %f", brightness); + + /* get AC status */ +@@ -436,6 +435,7 @@ + + /* only show dialog if interactive */ + if (interactive == TRUE) { ++ gpm_warning ("moo %f", brightness); + gpm_feedback_display_value (backlight->priv->feedback, (float) brightness); + } + +@@ -460,10 +460,13 @@ + gboolean on_ac; + on_ac = gpm_ac_adapter_is_present (backlight->priv->ac_adapter); + +- if (strcmp (key, GPM_CONF_BACKLIGHT_BRIGHTNESS_AC) == 0) { ++ if (on_ac && strcmp (key, GPM_CONF_BACKLIGHT_BRIGHTNESS_AC) == 0) { ++ gpm_conf_get_uint (backlight->priv->conf, ++ GPM_CONF_BACKLIGHT_BRIGHTNESS_AC, ++ &backlight->priv->master_percentage); + gpm_backlight_brightness_evaluate_and_set (backlight, FALSE); + +- } else if (strcmp (key, GPM_CONF_BACKLIGHT_BRIGHTNESS_BATT) == 0) { ++ } else if (!on_ac && strcmp (key, GPM_CONF_BACKLIGHT_BRIGHTNESS_BATT) == 0) { + gpm_backlight_brightness_evaluate_and_set (backlight, FALSE); + } + +@@ -501,29 +504,46 @@ + } + + /** +- * button_pressed_cb: ++ * gpm_backlight_button_pressed_cb: + * @power: The power class instance + * @type: The button type, e.g. "power" + * @state: The state, where TRUE is depressed or closed + * @brightness: This class instance + **/ + static void +-button_pressed_cb (GpmButton *button, +- const gchar *type, +- GpmBacklight *backlight) ++gpm_backlight_button_pressed_cb (GpmButton *button, ++ const gchar *type, ++ GpmBacklight *backlight) + { ++ guint percentage; + gpm_debug ("Button press event type=%s", type); + + if (strcmp (type, GPM_BUTTON_BRIGHT_UP) == 0) { + + if (backlight->priv->can_dim == TRUE) { ++ /* go up one step */ + gpm_brightness_lcd_up (backlight->priv->brightness); ++ ++ /* get the new value */ ++ gpm_brightness_lcd_get (backlight->priv->brightness, &percentage); ++ gpm_feedback_display_value (backlight->priv->feedback, (float) percentage/100.0f); ++ ++ /* save the new percentage */ ++ backlight->priv->master_percentage = percentage; + } + + } else if (strcmp (type, GPM_BUTTON_BRIGHT_DOWN) == 0) { + + if (backlight->priv->can_dim == TRUE) { ++ /* go down one step */ + gpm_brightness_lcd_down (backlight->priv->brightness); ++ ++ /* get the new value */ ++ gpm_brightness_lcd_get (backlight->priv->brightness, &percentage); ++ gpm_feedback_display_value (backlight->priv->feedback, (float) percentage/100.0f); ++ ++ /* save the new percentage */ ++ backlight->priv->master_percentage = percentage; + } + + } else if (strcmp (type, GPM_BUTTON_LID_OPEN) == 0) { +@@ -863,10 +883,16 @@ + GPM_CONF_GNOME_SS_PM_DELAY, + backlight->priv->idle_dim_timeout); + ++ /* set the main brightness, this is designed to be updated if the user changes the ++ * brightness so we can undim to the 'correct' value */ ++ gpm_conf_get_uint (backlight->priv->conf, ++ GPM_CONF_BACKLIGHT_BRIGHTNESS_AC, ++ &backlight->priv->master_percentage); ++ + /* watch for brightness up and down buttons and also check lid state */ + backlight->priv->button = gpm_button_new (); + g_signal_connect (backlight->priv->button, "button-pressed", +- G_CALLBACK (button_pressed_cb), backlight); ++ G_CALLBACK (gpm_backlight_button_pressed_cb), backlight); + + /* we use ac_adapter for the ac-adapter-changed signal */ + backlight->priv->ac_adapter = gpm_ac_adapter_new ();