gnome-settings-daemon/0001-Avoid-volumes-going-over-100.patch
2009-11-09 21:00:09 +00:00

36 lines
1.5 KiB
Diff

From c05c9b8c19f4c735ac1809f8bc61a3c13ea42c12 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 5 Nov 2009 22:21:52 +0000
Subject: [PATCH] Avoid volumes going over 100%
Because we don't handle that.
https://bugzilla.gnome.org/show_bug.cgi?id=600770
---
plugins/media-keys/gsd-media-keys-manager.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index b10fc64..86cb9d4 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -618,11 +618,13 @@ update_dialog (GsdMediaKeysManager *manager,
guint vol,
gboolean muted)
{
+ vol = (int) (100 * (double) vol / PA_VOLUME_NORM);
+ vol = CLAMP (vol, 0, 100);
+
dialog_init (manager);
gsd_media_keys_window_set_volume_muted (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
muted);
- gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
- (int) (100 * (double)vol / PA_VOLUME_NORM));
+ gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog), vol);
gsd_media_keys_window_set_action (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME);
dialog_show (manager);
--
1.6.5.2