[gnome-settings-daemon] gsd: Control panel and function key should not set brightness to 0



commit e5195f9e2bdfa2ab481b2f46a1e4c6987c713eb9
Author: Jian-Hong Pan <jian-hong endlessm com>
Date:   Fri Sep 28 18:00:42 2018 +0800

    gsd: Control panel and function key should not set brightness to 0
    
    The user could slide the brightness on the control panel or press the
    function key to make the screen brightness to 0.
    
    However, If the users do not know about the keyboard buttons, they will
    have a hard time turning the display back from the control panel if the
    display is too dim or completely off.
    For example, systems like ASUS UX550GE's brightness is in the range from
    1 to 120000.  The brightness level 1 has the backlight level which is so
    dim and it's also practically unusable.
    
    This patch makes it limiting to 1% brightness as the lower bound for
    avoiding that usability issue. #54
    
    Signed-off-by: Jian-Hong Pan <jian-hong endlessm com>

 plugins/power/gsd-backlight.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plugins/power/gsd-backlight.c b/plugins/power/gsd-backlight.c
index 2159f429..33e46af7 100644
--- a/plugins/power/gsd-backlight.c
+++ b/plugins/power/gsd-backlight.c
@@ -221,9 +221,9 @@ gsd_backlight_udev_init (GsdBacklight *backlight)
         if (backlight->udev_device == NULL)
                 return FALSE;
 
-        backlight->brightness_min = 1;
         backlight->brightness_max = g_udev_device_get_sysfs_attr_as_int (backlight->udev_device,
                                                                          "max_brightness");
+        backlight->brightness_min = MAX (1, backlight->brightness_max * 0.01);
 
         /* If the interface has less than 100 possible values, and it is of type
          * raw, then assume that 0 does not turn off the backlight completely. */
@@ -726,7 +726,7 @@ gsd_backlight_initable_init (GInitable       *initable,
         output = gsd_backlight_rr_find_output (backlight, TRUE);
         if (output) {
                 g_debug ("Using GNOME RR (mutter) for backlight.");
-                backlight->brightness_min = 0;
+                backlight->brightness_min = 1;
                 backlight->brightness_max = 100;
                 backlight->brightness_val = gnome_rr_output_get_backlight (output);
                 backlight->brightness_step = gnome_rr_output_get_min_backlight_step (output);


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