Implement backlight brightness curve

This MR is based on a previous MR by Diego Escalante Urrelo.

gsd-power controls how the desktop changes brightness on key events, or when adjusting gnome-shell or gnome-control-center brightness sliders.

This API takes a value from 0-100, representing a 1:1 relation to the backlight's brightness level. This range is divided by default into 20 steps, this means that you have 20 equally spaced brightness settings to choose from.

However, the above presents a usability problem as humans do not perceive brightness linearly. At low brightness, steps appear far too large, while at high brightness, they appear exceedingly small.

This commit fixes that issue by introducing a brightness curve map and setting it transparently to anyone using gsd-power API (shell/settings/dbus).

Curve Comparison:

gsd brightness curve v2.png

The default linear scaling is in orange and labeled column C, while the new scaling is in blue and labeled column B.

If the scale attribute of the backlight is linear, the brightness curve will be used. If it is non-linear, it will not be used. Since the scale is unknown for many backlights when it in fact should be linear, the brightness curve is applied when the scale is unknown, but not if the number of steps for the backlight is less than 99.

Closes #719

Edited by Basil Mari

Merge request reports