1
Description: Allow volume to bet set above 100%.
2
Some systems have low maximum volume set (like x220), allow, from an option
3
in gnome-control-center to set it above that 100% limit.
4
Modified from original patch in ubuntu-settings-daemon from Lars Uebernickel.
6
Bug-Ubuntu: https://launchpad.net/bugs/1706524
7
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=710424
9
plugins/media-keys/gsd-media-keys-manager.c | 27 ++++++++++++++++++++++++---
10
1 file changed, 24 insertions(+), 3 deletions(-)
12
--- a/plugins/media-keys/gsd-media-keys-manager.c
13
+++ b/plugins/media-keys/gsd-media-keys-manager.c
14
@@ -167,6 +167,7 @@ struct GsdMediaKeysManagerPrivate
17
GHashTable *custom_settings;
18
+ GSettings *sound_settings;
22
@@ -1146,6 +1147,18 @@ ensure_canberra (GsdMediaKeysManager *ma
23
if (manager->priv->ca != NULL)
26
+ if (strstr (g_getenv("XDG_CURRENT_DESKTOP"), "ubuntu") != NULL) {
27
+ GSettingsSchema *schema;
28
+ schema = g_settings_schema_source_lookup(g_settings_schema_source_get_default(),
29
+ "com.ubuntu.sound", TRUE);
33
+ manager->priv->sound_settings = g_settings_new_full(schema, NULL, NULL);
34
+ g_settings_schema_unref(schema);
38
ca_context_create (&manager->priv->ca);
39
ca_context_set_driver (manager->priv->ca, "pulse");
40
ca_context_change_props (manager->priv->ca, 0,
41
@@ -1166,6 +1179,7 @@ update_dialog (GsdMediaKeysManager *mana
44
gboolean sound_changed,
45
+ pa_volume_t max_volume,
48
GvcMixerUIDevice *device;
49
@@ -1173,7 +1187,7 @@ update_dialog (GsdMediaKeysManager *mana
53
- vol = (int) (100 * (double) vol / PA_VOLUME_NORM);
54
+ vol = (int) (100 * (double) vol / max_volume);
55
vol = CLAMP (vol, 0, 100);
58
@@ -1329,6 +1343,7 @@ do_sound_action (GsdMediaKeysManager *ma
59
gboolean old_muted, new_muted;
60
guint old_vol, new_vol, norm_vol_step;
61
gboolean sound_changed;
62
+ pa_volume_t max_volume;
64
/* Find the stream that corresponds to the device, if any */
66
@@ -1348,6 +1363,11 @@ do_sound_action (GsdMediaKeysManager *ma
70
+ if ((manager->priv->sound_settings != NULL) && g_settings_get_boolean (manager->priv->sound_settings, "allow-amplified-volume"))
71
+ max_volume = PA_VOLUME_UI_MAX;
73
+ max_volume = PA_VOLUME_NORM;
75
if (flags & SOUND_ACTION_FLAG_IS_PRECISE)
76
norm_vol_step = PA_VOLUME_NORM * VOLUME_STEP_PRECISE / 100;
78
@@ -1374,7 +1394,7 @@ do_sound_action (GsdMediaKeysManager *ma
80
/* When coming out of mute only increase the volume if it was 0 */
81
if (!old_muted || old_vol == 0)
82
- new_vol = MIN (old_vol + norm_vol_step, MAX_VOLUME);
83
+ new_vol = MIN (old_vol + norm_vol_step, max_volume);
87
@@ -1391,7 +1411,7 @@ do_sound_action (GsdMediaKeysManager *ma
90
update_dialog (manager, stream, new_vol, new_muted, sound_changed,
91
- flags & SOUND_ACTION_FLAG_IS_QUIET);
92
+ max_volume, flags & SOUND_ACTION_FLAG_IS_QUIET);
96
@@ -2963,6 +2983,7 @@ gsd_media_keys_manager_stop (GsdMediaKey
97
g_clear_object (&priv->power_proxy);
98
g_clear_object (&priv->power_screen_proxy);
99
g_clear_object (&priv->power_keyboard_proxy);
100
+ g_clear_object (&priv->sound_settings);
101
g_clear_object (&priv->composite_device);
102
g_clear_object (&priv->mpris_controller);
103
g_clear_object (&priv->screencast_proxy);