power: Use logind helper to change backlight brightness
This is the favored method, over our own polkit helper, and over RandR.
Since this helper does its own smart queueing of events, just forward them
as fast as possible, and mark all tasks as completed ASAP on our side.
However, as this is a recent logind feature (New in systemd 243), make this
a soft runtime dependency, by checking first that the required DBus method
exists. We forget about logind and go through the other methods if this one
is not available.
media-keys: Let the screenshot service save to clipboard itself
This is both broken currently on wayland (since this daemon doesn't
request the x11 backend, and wayland clients need a proper surface/serial
to request clipboard), and conceptually wrong (we wouldn't like to
enable the X11 backend just to let it save to clipboard).
Let gnome-shell handle saving the screenshot to clipboard instead, this
also saves us from saving to /tmp just to copy it to the clipboard
afterwards. We achieve this by passing an empty string as the filename.
db37493...
by
Benjamin Otte <email address hidden>
power: Fix rounding of brightness value
We rounded properly for percentage to absolute value, but we always floored the other way around.
The new code achieves this by always rounding. This way the following rule holds (assuming the the min value is 0 for this discussion)
x = round (round (x * scale) / scale)
with
scale = (max - min) / 100
and assuming that scale >= 1
If scale < 1, the rule holds for the other direction.