mate-desktop / mate-power-manager

Power management tool for the MATE desktop
https://mate-desktop.org
GNU General Public License v2.0
59 stars 51 forks source link

brightness applet: Prevent sliding from bogging down the UI #354

Closed cwendling closed 3 years ago

cwendling commented 3 years ago

Do not perform a synchronous DBus call to update the brightness in real time when the slider move, because at least on some hardware the call is slow, which leads to the UI bogging down and looking frozen.

To fix this, cap the update rate in response to slider motion. This makes the brightness apply slightly slower, but prevent most bogging down (if the rate is well chosen, at least).

Ideally we would perform asynchronous DBus calls, but:

  1. We should still not spam the bus anyway, so it's orthogonal to the fix here
  2. That's IMO something that would better be done after migrating from dbus-glib to GDBus, as the GDBus APIs are different (and nicer), and thus would somewhat double the work necessary (and make the migration harder).

To test this, you need dimable hardware supported by mate-power-manager ("most" laptops should work). Then, open the slider of the Brightness applet, and drag it up and down with the mouse. Without this patch, you might get a weird experience where the slider jumps seemingly erratically, depending on your hardware (about ⅔ of the laptops I manager to try out were impacted). With this patch, moving the slider should be smooth, whichever hardware you have.

alexarnaud commented 3 years ago

@raveit65 do you think we could/should backport it for next 1.24.x release?

raveit65 commented 3 years ago

Done. https://github.com/mate-desktop/mate-power-manager/commit/ecf24bdb7668a01e759050fff9d7ad74810863d5