summaryrefslogtreecommitdiff
path: root/plugins/media-keys
diff options
context:
space:
mode:
authorDidier Roche <didrocks@ubuntu.com>2017-11-15 17:41:35 +0100
committerCarlos Garnacho <mrgarnacho@gmail.com>2018-08-01 18:13:56 +0000
commita3f0d1501cd24b173c61e3f40616146fcbcf6bf4 (patch)
tree56a816dad35e9e6a758f57daf76c695db4f8409f /plugins/media-keys
parent148d893ddfb818cab69393076068f2305306a586 (diff)
downloadgnome-settings-daemon-a3f0d1501cd24b173c61e3f40616146fcbcf6bf4.tar.gz
media-keys: Use similar logic to the Shell to show volume above 100% icon
Shows a volume above 100% icon for output only in case we have a current level above 100. This new icon will be sent to any Shell version, including older version which will show up 100 for level and this volume above 100% icon. See https://bugzilla.gnome.org/show_bug.cgi?id=790280
Diffstat (limited to 'plugins/media-keys')
-rw-r--r--plugins/media-keys/gsd-media-keys-manager.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 575bb09f..7925b513 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -409,6 +409,7 @@ get_icon_name_for_volume (gboolean is_mic,
"audio-volume-low-symbolic",
"audio-volume-medium-symbolic",
"audio-volume-high-symbolic",
+ "audio-volume-overamplified-symbolic",
NULL
};
static const char *mic_icon_names[] = {
@@ -424,12 +425,14 @@ get_icon_name_for_volume (gboolean is_mic,
n = 0;
} else {
/* select image */
- n = 3 * volume / 100 + 1;
- if (n < 1) {
+ n = ceill (3.0 * (double) volume / 100);
+ if (n < 1)
n = 1;
- } else if (n > 3) {
+ /* output volume above 100% */
+ else if (n > 3 && !is_mic)
+ n = 4;
+ else if (n > 3)
n = 3;
- }
}
if (is_mic)