[gnome-settings-daemon] media-keys: Add custom shortcut type
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] media-keys: Add custom shortcut type
- Date: Wed, 2 Nov 2011 20:13:22 +0000 (UTC)
commit e67ccaf903b1a807c5cd032a93a80d8be77bcf52
Author: Bastien Nocera <hadess hadess net>
Date: Wed Nov 2 15:30:43 2011 +0000
media-keys: Add custom shortcut type
plugins/media-keys/gsd-media-keys-manager.c | 14 ++++++++++++++
plugins/media-keys/shortcuts-list.h | 1 +
2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 7c6a4d2..67e8f95 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -1556,6 +1556,13 @@ do_keyboard_brightness_action (GsdMediaKeysManager *manager,
manager);
}
+static void
+do_custom_action (GsdMediaKeysManager *manager,
+ MediaKey *key,
+ gint64 timestamp)
+{
+}
+
static gboolean
do_action (GsdMediaKeysManager *manager,
guint deviceid,
@@ -1694,6 +1701,8 @@ do_action (GsdMediaKeysManager *manager,
do_execute_desktop (manager, "gnome-power-statistics.desktop", timestamp);
break;
/* Note, no default so compiler catches missing keys */
+ case CUSTOM_KEY:
+ g_assert_not_reached ();
}
return FALSE;
@@ -1768,6 +1777,11 @@ filter_key_events (XEvent *xevent,
manager->priv->current_screen = get_screen_from_root (manager, xev->root);
+ if (key->key_type == CUSTOM_KEY) {
+ do_custom_action (manager, key, xev->time);
+ return GDK_FILTER_REMOVE;
+ }
+
if (do_action (manager, deviceid, key->key_type, xev->time) == FALSE) {
return GDK_FILTER_REMOVE;
} else {
diff --git a/plugins/media-keys/shortcuts-list.h b/plugins/media-keys/shortcuts-list.h
index c3616fc..71b0f76 100644
--- a/plugins/media-keys/shortcuts-list.h
+++ b/plugins/media-keys/shortcuts-list.h
@@ -74,6 +74,7 @@ typedef enum {
KEYBOARD_BRIGHTNESS_DOWN_KEY,
KEYBOARD_BRIGHTNESS_TOGGLE_KEY,
BATTERY_KEY,
+ CUSTOM_KEY
} MediaKeyType;
static struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]