Bug#775650: gnome-shell: Brightness slider moves uncontrollably.

Jonathan Moreno jorgej0805 at gmail.com
Sun Jan 18 04:15:04 UTC 2015


Package: gnome-shell
Version: 3.14.2-3+b1
Severity: normal
Tags: patch

Dear Maintainer,

My computer is a Sony VAIO VPCEA45FL laptop, with 9 different brightness
levels.

The brightness slider on the shell's top panel moves uncontrollably when trying
to adjust screen brightness.

   * What led up to the situation? Installing GNOME 3.14 on Jessie.

   * What exactly did you do (or not do) that was effective (or
     ineffective)? Scrolling or dragging the brightness slider.

   * What was the outcome of this action? Slider moves erratically, along with
the screen's brightness levels.

   * What outcome did you expect instead? I expected the slider to move
normally, adjusting the brightness accordingly.

It seems to be that two methods are involved in this, in file
js/ui/status/brightness.js, the _sliderChanged and the _sync functions, the
first takes the slider value and sets the brightness and the second syncs the
slider, taking the brightness value and setting the slider, basically making a
recursive call between them. I made this patch were I added a variable that
counts the instances were the brightness was changed by the slider, so it only
syncs when brightness was changed by an external factor (e.g. fn brightness
keys).

## BEGINNING OF FILE ##############################################
Index: gnome-shell-3.14.2/js/ui/status/brightness.js
===================================================================
--- gnome-shell-3.14.2.orig/js/ui/status/brightness.js
+++ gnome-shell-3.14.2/js/ui/status/brightness.js
@@ -19,6 +19,8 @@ const BrightnessInterface = '<node> \

 const BrightnessProxy = Gio.DBusProxy.makeProxyWrapper(BrightnessInterface);

+var changeCount = 0;
+
 const Indicator = new Lang.Class({
     Name: 'BrightnessIndicator',
     Extends: PanelMenu.SystemIndicator,
@@ -58,13 +60,18 @@ const Indicator = new Lang.Class({

     _sliderChanged: function(slider, value) {
         let percent = value * 100;
+        changeCount++;
         this._proxy.Brightness = percent;
     },

     _sync: function() {
-        let visible = this._proxy.Brightness >= 0;
-        this._item.actor.visible = visible;
-        if (visible)
-            this._slider.setValue(this._proxy.Brightness / 100.0);
+        if (changeCount==0&&!this._slider._dragging) {
+            let visible = this._proxy.Brightness >= 0;
+            this._item.actor.visible = visible;
+            if (visible)
+                this._slider.setValue(this._proxy.Brightness / 100.0);
+        }
+        if(changeCount>0)
+            changeCount--;
     },
 });
## END OF FILE ####################################################

This fixed the problem for me, but the actual change in brightness can be very
slow, probably because it requests a change for every little change in the
slider,
which I think it's every 2%, so I added some changes to this patch, so just
changes bigger than 5 percent are requested, however this may affect systems
with
more than 20 different levels, but I'm including it in case you may find it
useful,

## BEGINNING OF FILE ##############################################
Index: gnome-shell-3.14.2/js/ui/status/brightness.js
===================================================================
--- gnome-shell-3.14.2.orig/js/ui/status/brightness.js
+++ gnome-shell-3.14.2/js/ui/status/brightness.js
@@ -19,6 +19,9 @@ const BrightnessInterface = '<node> \

 const BrightnessProxy = Gio.DBusProxy.makeProxyWrapper(BrightnessInterface);

+var changeCount = 0;
+var lastValue = 0;
+
 const Indicator = new Lang.Class({
     Name: 'BrightnessIndicator',
     Extends: PanelMenu.SystemIndicator,
@@ -53,18 +56,27 @@ const Indicator = new Lang.Class({
         this._item.actor.connect('key-press-event', Lang.bind(this,
function(actor, event) {
             return this._slider.onKeyPressEvent(actor, event);
         }));
+        lastValue = this._proxy.Brightness;

     },

     _sliderChanged: function(slider, value) {
         let percent = value * 100;
-        this._proxy.Brightness = percent;
+        if(Math.abs(percent-lastValue)>=5||percent==0||percent==100) {
+            changeCount++;
+            this._proxy.Brightness = percent;
+            lastValue = percent;
+        }
     },

     _sync: function() {
-        let visible = this._proxy.Brightness >= 0;
-        this._item.actor.visible = visible;
-        if (visible)
-            this._slider.setValue(this._proxy.Brightness / 100.0);
+        if (changeCount==0&&!this._slider._dragging) {
+            let visible = this._proxy.Brightness >= 0;
+            this._item.actor.visible = visible;
+            if (visible)
+                this._slider.setValue(this._proxy.Brightness / 100.0);
+        }
+        if(changeCount>0)
+            changeCount--;
     },
 });
## END OF FILE ####################################################

A proper fix would probably be implementing detection of available
brightness levels, but that's beyond my skills.

Thanks for your attention.



-- System Information:
Debian Release: 8.0
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=es_MX.UTF-8, LC_CTYPE=es_MX.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages gnome-shell depends on:
ii  dconf-gsettings-backend [gsettings-backend]  0.22.0-1
ii  evolution-data-server                        3.12.9~git20141128.5242b0-2+b1
ii  gir1.2-accountsservice-1.0                   0.6.37-3+b1
ii  gir1.2-atspi-2.0                             2.14.0-1
ii  gir1.2-caribou-1.0                           0.4.15-1
ii  gir1.2-clutter-1.0                           1.20.0-1
ii  gir1.2-freedesktop                           1.42.0-2.2
ii  gir1.2-gcr-3                                 3.14.0-2
ii  gir1.2-gdesktopenums-3.0                     3.14.1-1
ii  gir1.2-gdm3                                  3.14.1-3
ii  gir1.2-gkbd-3.0                              3.6.0-1
ii  gir1.2-glib-2.0                              1.42.0-2.2
ii  gir1.2-gnomebluetooth-1.0                    3.14.0-2
ii  gir1.2-gnomedesktop-3.0                      3.14.1-1
ii  gir1.2-gtk-3.0                               3.14.5-1
ii  gir1.2-ibus-1.0                              1.5.9-1
ii  gir1.2-mutter-3.0                            3.14.2-1
ii  gir1.2-networkmanager-1.0                    0.9.10.0-5
ii  gir1.2-nmgtk-1.0                             0.9.10.0-2
ii  gir1.2-pango-1.0                             1.36.8-3
ii  gir1.2-polkit-1.0                            0.105-8
ii  gir1.2-soup-2.4                              2.48.0-1
ii  gir1.2-telepathyglib-0.12                    0.24.1-1
ii  gir1.2-telepathylogger-0.2                   0.8.1-1
ii  gir1.2-upowerglib-1.0                        0.99.1-3.1
ii  gjs                                          1.42.0-1
ii  gnome-backgrounds                            3.14.1-1
ii  gnome-icon-theme-symbolic                    3.12.0-1
ii  gnome-settings-daemon                        3.14.2-2
ii  gnome-shell-common                           3.14.2-3
ii  gnome-themes-standard                        3.14.2.2-1
ii  gsettings-desktop-schemas                    3.14.1-1
ii  libatk-bridge2.0-0                           2.14.0-2
ii  libatk1.0-0                                  2.14.0-1
ii  libc6                                        2.19-13
ii  libcairo2                                    1.14.0-2.1
ii  libcanberra-gtk3-0                           0.30-2.1
ii  libcanberra0                                 0.30-2.1
ii  libclutter-1.0-0                             1.20.0-1
ii  libcogl-pango20                              1.18.2-3
ii  libcogl20                                    1.18.2-3
ii  libcroco3                                    0.6.8-3+b1
ii  libdbus-glib-1-2                             0.102-1
ii  libecal-1.2-16                               3.12.9~git20141128.5242b0-2+b1
ii  libedataserver-1.2-18                        3.12.9~git20141128.5242b0-2+b1
ii  libgcr-base-3-1                              3.14.0-2
ii  libgdk-pixbuf2.0-0                           2.31.1-2+b1
ii  libgirepository-1.0-1                        1.42.0-2.2
ii  libgjs0e [libgjs0-libmozjs-24-0]             1.42.0-1
ii  libglib2.0-0                                 2.42.1-1
ii  libgstreamer1.0-0                            1.4.4-2
ii  libgtk-3-0                                   3.14.5-1
ii  libical1a                                    1.0-1.3
ii  libjson-glib-1.0-0                           1.0.2-1
ii  libmozjs-24-0                                24.2.0-2
ii  libmutter0e                                  3.14.2-1
ii  libnm-glib4                                  0.9.10.0-5
ii  libnm-util2                                  0.9.10.0-5
ii  libpango-1.0-0                               1.36.8-3
ii  libpangocairo-1.0-0                          1.36.8-3
ii  libpolkit-agent-1-0                          0.105-8
ii  libpolkit-gobject-1-0                        0.105-8
ii  libpulse-mainloop-glib0                      5.0-13
ii  libpulse0                                    5.0-13
ii  libsecret-1-0                                0.18-1+b1
ii  libstartup-notification0                     0.12-4
ii  libsystemd0                                  215-8
ii  libtelepathy-glib0                           0.24.1-1
ii  libx11-6                                     2:1.6.2-3
ii  libxfixes3                                   1:5.0.1-2+b2
ii  mutter                                       3.14.2-1
ii  python                                       2.7.8-2
ii  telepathy-mission-control-5                  1:5.16.3-1

Versions of packages gnome-shell recommends:
ii  gdm3                  3.14.1-3
ii  gkbd-capplet          3.6.0-1
ii  gnome-contacts        3.14.1-1
ii  gnome-control-center  1:3.14.2-2
ii  gnome-user-guide      3.14.1-1
ii  unzip                 6.0-14

gnome-shell suggests no packages.

-- no debconf information



More information about the pkg-gnome-maintainers mailing list