[gnome-settings-daemon] media-keys: Make sound changes quiet with Alt
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] media-keys: Make sound changes quiet with Alt
- Date: Fri, 10 Jun 2011 14:03:30 +0000 (UTC)
commit 1d41ab388a06844c4b46cee6e396a4976f136770
Author: Bastien Nocera <hadess hadess net>
Date: Fri Jun 10 15:00:33 2011 +0100
media-keys: Make sound changes quiet with Alt
<Alt>+volume control keys will change the sound, without
playing a notification sound, which can be useful when things need
to be quiet.
Note that this doesn't use the settings stored in GSettings, but
is hard-coded for those audio keys.
https://bugzilla.gnome.org/show_bug.cgi?id=651704
plugins/media-keys/acme.h | 8 ++++++-
plugins/media-keys/gsd-media-keys-manager.c | 29 ++++++++++++++++++++++----
2 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/plugins/media-keys/acme.h b/plugins/media-keys/acme.h
index 73b01df..ac58d7b 100644
--- a/plugins/media-keys/acme.h
+++ b/plugins/media-keys/acme.h
@@ -32,6 +32,9 @@ typedef enum {
MUTE_KEY,
VOLUME_DOWN_KEY,
VOLUME_UP_KEY,
+ MUTE_QUIET_KEY,
+ VOLUME_DOWN_QUIET_KEY,
+ VOLUME_UP_QUIET_KEY,
LOGOUT_KEY,
EJECT_KEY,
HOME_KEY,
@@ -74,9 +77,12 @@ static struct {
{ TOUCHPAD_KEY, NULL, "XF86TouchpadToggle", NULL },
{ TOUCHPAD_ON_KEY, NULL, "XF86TouchpadOn", NULL },
{ TOUCHPAD_OFF_KEY, NULL, "XF86TouchpadOff", NULL },
- { MUTE_KEY, "volume-mute",NULL, NULL },
+ { MUTE_KEY, "volume-mute", NULL, NULL },
{ VOLUME_DOWN_KEY, "volume-down", NULL, NULL },
{ VOLUME_UP_KEY, "volume-up", NULL, NULL },
+ { MUTE_QUIET_KEY, NULL, "<Alt>XF86AudioMute", NULL },
+ { VOLUME_DOWN_QUIET_KEY, NULL, "<Alt>XF86AudioLowerVolume", NULL },
+ { VOLUME_UP_QUIET_KEY, NULL, "<Alt>XF86AudioRaiseVolume", NULL },
{ LOGOUT_KEY, "logout", NULL, NULL },
{ EJECT_KEY, "eject", NULL, NULL },
{ HOME_KEY, "home", NULL, NULL },
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index b2171d0..b6e9cf9 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -609,7 +609,8 @@ update_dialog (GsdMediaKeysManager *manager,
guint vol,
guint max_vol,
gboolean muted,
- gboolean sound_changed)
+ gboolean sound_changed,
+ gboolean quiet)
{
vol = (int) (100 * (double) vol / (double) max_vol);
vol = CLAMP (vol, 0, 100);
@@ -622,7 +623,7 @@ update_dialog (GsdMediaKeysManager *manager,
GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME);
dialog_show (manager);
- if (sound_changed != FALSE && muted == FALSE)
+ if (quiet == FALSE && sound_changed != FALSE && muted == FALSE)
ca_gtk_play_for_widget (manager->priv->dialog, 0,
CA_PROP_EVENT_ID, "audio-volume-change",
CA_PROP_EVENT_DESCRIPTION, "volume changed through key press",
@@ -632,7 +633,8 @@ update_dialog (GsdMediaKeysManager *manager,
static void
do_sound_action (GsdMediaKeysManager *manager,
- int type)
+ int type,
+ gboolean quiet)
{
gboolean old_muted, new_muted;
guint old_vol, new_vol, max_vol, norm_vol_step;
@@ -681,7 +683,7 @@ do_sound_action (GsdMediaKeysManager *manager,
}
}
- update_dialog (manager, new_vol, max_vol, new_muted, sound_changed);
+ update_dialog (manager, new_vol, max_vol, new_muted, sound_changed, quiet);
}
static void
@@ -1172,7 +1174,22 @@ do_action (GsdMediaKeysManager *manager,
case VOLUME_DOWN_KEY:
case VOLUME_UP_KEY:
#ifdef HAVE_PULSE
- do_sound_action (manager, type);
+ do_sound_action (manager, type, FALSE);
+#endif /* HAVE_PULSE */
+ break;
+ case MUTE_QUIET_KEY:
+#ifdef HAVE_PULSE
+ do_sound_action (manager, MUTE_KEY, TRUE);
+#endif /* HAVE_PULSE */
+ break;
+ case VOLUME_DOWN_QUIET_KEY:
+#ifdef HAVE_PULSE
+ do_sound_action (manager, VOLUME_DOWN_KEY, TRUE);
+#endif /* HAVE_PULSE */
+ break;
+ case VOLUME_UP_QUIET_KEY:
+#ifdef HAVE_PULSE
+ do_sound_action (manager, VOLUME_UP_KEY, TRUE);
#endif /* HAVE_PULSE */
break;
case LOGOUT_KEY:
@@ -1316,6 +1333,8 @@ acme_filter_events (GdkXEvent *xevent,
switch (keys[i].key_type) {
case VOLUME_DOWN_KEY:
case VOLUME_UP_KEY:
+ case VOLUME_DOWN_QUIET_KEY:
+ case VOLUME_UP_QUIET_KEY:
/* auto-repeatable keys */
if (xev->type != KeyPress) {
return GDK_FILTER_CONTINUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]