shellDBus: Use floats instead of percentages for OSD levels

Due to typecasting being done when converting floats to integers in
gnome-settings-daemon, a volume of 0.9% in g-s-d will end up as 0% in
gnome-shell. This can lead to a mismatch of icons between the volume OSD
(the icon to use is determined by g-s-d itself) and the shells own
volume indicator (the icon to use is determined by the shell using the
volume received from g-s-d).

To fix this, simply get rid of the conversion from float to percentage
in g-s-d and back to floats in the shell and just send a float/double
value on DBus.

https://gitlab.gnome.org/GNOME/gnome-settings-daemon/merge_requests/78
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/385
This commit is contained in:
Jonas Dreßler 2019-07-27 19:29:36 +02:00 committed by Florian Müllner
parent 2f29081667
commit 89ce53e3ff

View File

@ -94,12 +94,6 @@ var GnomeShell = class {
if (serializedIcon)
icon = Gio.Icon.new_for_string(serializedIcon);
// Translate from percentages in the D-Bus API to floats
if (!isNaN(level))
level /= 100;
if (!isNaN(maxLevel))
maxLevel /= 100;
Main.osdWindowManager.show(monitorIndex, icon, label, level, maxLevel);
}