[Xfce4-commits] [xfce/xfce4-power-manager] 03/03: xfpm_backlight_button_pressed_cb: fix popup display

noreply at xfce.org noreply at xfce.org
Sun Apr 13 19:35:30 CEST 2014


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/xfce4-power-manager.

commit cc57e74499209ca28b4bc0b2d12c6569e254c449
Author: Stefan Seyfried <seife+dev at b1-systems.com>
Date:   Sun Apr 13 18:17:29 2014 +0200

    xfpm_backlight_button_pressed_cb: fix popup display
    
    With /xfce4-power-manager/change-brightness-on-key-events=false, the
    level variable is used uninitialized and the popup's level gauge is
    wrong. Slight Code reformatting included, to avoid duplicating most
    of the code.  (Rebased version of a patch I wrote a year ago)
    
    Signed-off-by: Eric Koegel <eric.koegel at gmail.com>
---
 src/xfpm-backlight.c |   23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/xfpm-backlight.c b/src/xfpm-backlight.c
index 45c990f..a13ab84 100644
--- a/src/xfpm-backlight.c
+++ b/src/xfpm-backlight.c
@@ -202,22 +202,21 @@ xfpm_backlight_button_pressed_cb (XfpmButton *button, XfpmButtonKey type, XfpmBa
 		  SHOW_BRIGHTNESS_POPUP, &show_popup,
                   NULL);
     
-    if ( type == BUTTON_MON_BRIGHTNESS_UP )
+    if ( type != BUTTON_MON_BRIGHTNESS_UP && type != BUTTON_MON_BRIGHTNESS_DOWN )
+	return; /* sanity check, can this ever happen? */
+
+    backlight->priv->block = TRUE;
+    if ( !enable_brightness )
+	ret = xfpm_brightness_get_level (backlight->priv->brightness, &level);
+    else
     {
-	backlight->priv->block = TRUE;
-	if ( enable_brightness )
+	if ( type == BUTTON_MON_BRIGHTNESS_UP )
 	    ret = xfpm_brightness_up (backlight->priv->brightness, &level);
-	if ( ret && show_popup)
-	    xfpm_backlight_show (backlight, level);
-    }
-    else if ( type == BUTTON_MON_BRIGHTNESS_DOWN )
-    {
-	backlight->priv->block = TRUE;
-	if ( enable_brightness )
+	else
 	    ret = xfpm_brightness_down (backlight->priv->brightness, &level);
-	if ( ret && show_popup)
-	    xfpm_backlight_show (backlight, level);
     }
+    if ( ret && show_popup)
+	xfpm_backlight_show (backlight, level);
 }
 
 static void

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list