[Xfce4-commits] <xfce4-power-manager:master> Only dim brightness if the current level is brighter.

Ali Abdallah noreply at xfce.org
Mon Jun 27 16:58:01 CEST 2011


Updating branch refs/heads/master
         to ab07509cdf0fa05c56ae61a020abce2ac1fb28cb (commit)
       from 6b86e87fabb8ffe7916aa9c18d8b21e8d7896870 (commit)

commit ab07509cdf0fa05c56ae61a020abce2ac1fb28cb
Author: Ali Abdallah <aliov at xfce.org>
Date:   Mon Jun 27 16:55:28 2011 +0200

    Only dim brightness if the current level is brighter.

 src/xfpm-backlight.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/xfpm-backlight.c b/src/xfpm-backlight.c
index 94a4f44..73bd5f6 100644
--- a/src/xfpm-backlight.c
+++ b/src/xfpm-backlight.c
@@ -104,9 +104,15 @@ xfpm_backlight_dim_brightness (XfpmBacklight *backlight)
 	
 	dim_level = dim_level * backlight->priv->max_level / 100;
 	
-	XFPM_DEBUG ("Current brightness level before dimming : %li, new %li", backlight->priv->last_level, dim_level);
-	
-	backlight->priv->dimmed = xfpm_brightness_set_level (backlight->priv->brightness, dim_level);
+	/**
+	 * Only reduce if the current level is brighter than
+	 * the configured dim_level
+	 **/
+	if (backlight->priv->last_level > dim_level)
+	{
+	    XFPM_DEBUG ("Current brightness level before dimming : %li, new %li", backlight->priv->last_level, dim_level);
+	    backlight->priv->dimmed = xfpm_brightness_set_level (backlight->priv->brightness, dim_level);
+	}
     }
 }
 



More information about the Xfce4-commits mailing list