[gnome-settings-daemon/gnome-2-28] Avoid volumes going over 100%



commit bf89dab7b19837740182329c812b3ac8e2ffe16f
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Nov 5 22:21:52 2009 +0000

    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 4cff061..72a0b4c 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]