|
|
14e627 |
From 80c1053d9100f604754ebc44b99d0d7bb37d6814 Mon Sep 17 00:00:00 2001
|
|
|
14e627 |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
14e627 |
Date: Thu, 11 Dec 2014 17:32:55 +0100
|
|
|
14e627 |
Subject: [PATCH 1/3] media-keys: Adjust to ShellKeyGrabber changes
|
|
|
14e627 |
|
|
|
14e627 |
The AcceleratorActivated signal now uses a dictionary for additional
|
|
|
14e627 |
parameters to make future additions easier.
|
|
|
14e627 |
---
|
|
|
14e627 |
plugins/media-keys/gsd-media-keys-manager.c | 13 +++++++++++--
|
|
|
14e627 |
plugins/media-keys/org.gnome.ShellKeyGrabber.xml | 3 +--
|
|
|
14e627 |
2 files changed, 12 insertions(+), 4 deletions(-)
|
|
|
14e627 |
|
|
|
14e627 |
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
|
|
|
14e627 |
index dcd14f2..1c00b85 100644
|
|
|
14e627 |
--- a/plugins/media-keys/gsd-media-keys-manager.c
|
|
|
14e627 |
+++ b/plugins/media-keys/gsd-media-keys-manager.c
|
|
|
14e627 |
@@ -2182,11 +2182,20 @@ do_action (GsdMediaKeysManager *manager,
|
|
|
14e627 |
static void
|
|
|
14e627 |
on_accelerator_activated (ShellKeyGrabber *grabber,
|
|
|
14e627 |
guint accel_id,
|
|
|
14e627 |
- guint deviceid,
|
|
|
14e627 |
- guint timestamp,
|
|
|
14e627 |
+ GVariant *parameters,
|
|
|
14e627 |
GsdMediaKeysManager *manager)
|
|
|
14e627 |
{
|
|
|
14e627 |
+ GVariantDict dict;
|
|
|
14e627 |
guint i;
|
|
|
14e627 |
+ guint deviceid;
|
|
|
14e627 |
+ guint timestamp;
|
|
|
14e627 |
+
|
|
|
14e627 |
+ g_variant_dict_init (&dict, parameters);
|
|
|
14e627 |
+
|
|
|
14e627 |
+ if (!g_variant_dict_lookup (&dict, "device-id", "u", &deviceid))
|
|
|
14e627 |
+ deviceid = 0;
|
|
|
14e627 |
+ if (!g_variant_dict_lookup (&dict, "timestamp", "u", ×tamp))
|
|
|
14e627 |
+ timestamp = GDK_CURRENT_TIME;
|
|
|
14e627 |
|
|
|
14e627 |
for (i = 0; i < manager->priv->keys->len; i++) {
|
|
|
14e627 |
MediaKey *key;
|
|
|
14e627 |
diff --git a/plugins/media-keys/org.gnome.ShellKeyGrabber.xml b/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
|
|
|
14e627 |
index b47e9c8..a245481 100644
|
|
|
14e627 |
--- a/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
|
|
|
14e627 |
+++ b/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
|
|
|
14e627 |
@@ -16,8 +16,7 @@
|
|
|
14e627 |
</method>
|
|
|
14e627 |
<signal name="AcceleratorActivated">
|
|
|
14e627 |
<arg type="u" name="action"/>
|
|
|
14e627 |
- <arg type="u" name="device"/>
|
|
|
14e627 |
- <arg type="u" name="timestamp"/>
|
|
|
14e627 |
+ <arg type="a{sv}" name="parameters"/>
|
|
|
14e627 |
</signal>
|
|
|
14e627 |
</interface>
|
|
|
14e627 |
</node>
|
|
|
14e627 |
--
|
|
|
14e627 |
2.3.6
|
|
|
14e627 |
|
|
|
14e627 |
|
|
|
14e627 |
From 8d3d496a3c36f2e884d6b3d5b3b050b4198bf8ba Mon Sep 17 00:00:00 2001
|
|
|
14e627 |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
14e627 |
Date: Fri, 19 Dec 2014 14:30:15 +0100
|
|
|
14e627 |
Subject: [PATCH 2/3] media-keys: Make power-actions non-interactive based on
|
|
|
14e627 |
mode
|
|
|
14e627 |
|
|
|
14e627 |
gnome-shell does not allow to grab any particular key combo more
|
|
|
14e627 |
than once, even when the corresponding keybinding modes don't
|
|
|
14e627 |
overlap, so the FOO_KEY_NO_DIALOG shortcuts introduced in commit
|
|
|
14e627 |
b7827c13d823 never actually worked.
|
|
|
14e627 |
Instead, use the new 'action-mode' parameter that was added to the
|
|
|
14e627 |
'Activated' signal to determine whether to a power action should
|
|
|
14e627 |
be interactive or not.
|
|
|
14e627 |
|
|
|
14e627 |
https://bugzilla.gnome.org/show_bug.cgi?id=741762
|
|
|
14e627 |
---
|
|
|
14e627 |
plugins/media-keys/gsd-media-keys-manager.c | 28 +++++++++++-----------------
|
|
|
14e627 |
plugins/media-keys/media-keys.h | 4 ----
|
|
|
14e627 |
plugins/media-keys/shortcuts-list.h | 13 ++++---------
|
|
|
14e627 |
3 files changed, 15 insertions(+), 30 deletions(-)
|
|
|
14e627 |
|
|
|
14e627 |
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
|
|
|
14e627 |
index 1c00b85..1108194 100644
|
|
|
14e627 |
--- a/plugins/media-keys/gsd-media-keys-manager.c
|
|
|
14e627 |
+++ b/plugins/media-keys/gsd-media-keys-manager.c
|
|
|
14e627 |
@@ -2014,11 +2014,14 @@ do_custom_action (GsdMediaKeysManager *manager,
|
|
|
14e627 |
static gboolean
|
|
|
14e627 |
do_action (GsdMediaKeysManager *manager,
|
|
|
14e627 |
guint deviceid,
|
|
|
14e627 |
+ guint mode,
|
|
|
14e627 |
MediaKeyType type,
|
|
|
14e627 |
gint64 timestamp)
|
|
|
14e627 |
{
|
|
|
14e627 |
g_debug ("Launching action for key type '%d' (on device id %d)", type, deviceid);
|
|
|
14e627 |
|
|
|
14e627 |
+ gboolean power_action_interactive = !(POWER_KEYS_MODE_NO_DIALOG & mode);
|
|
|
14e627 |
+
|
|
|
14e627 |
switch (type) {
|
|
|
14e627 |
case TOUCHPAD_KEY:
|
|
|
14e627 |
do_touchpad_action (manager);
|
|
|
14e627 |
@@ -2138,28 +2141,16 @@ do_action (GsdMediaKeysManager *manager,
|
|
|
14e627 |
do_toggle_contrast_action (manager);
|
|
|
14e627 |
break;
|
|
|
14e627 |
case POWER_KEY:
|
|
|
14e627 |
- do_config_power_action (manager, "button-power", FALSE);
|
|
|
14e627 |
+ do_config_power_action (manager, "button-power", power_action_interactive);
|
|
|
14e627 |
break;
|
|
|
14e627 |
case SLEEP_KEY:
|
|
|
14e627 |
- do_config_power_action (manager, "button-sleep", FALSE);
|
|
|
14e627 |
+ do_config_power_action (manager, "button-sleep", power_action_interactive);
|
|
|
14e627 |
break;
|
|
|
14e627 |
case SUSPEND_KEY:
|
|
|
14e627 |
- do_config_power_action (manager, "button-suspend", FALSE);
|
|
|
14e627 |
+ do_config_power_action (manager, "button-suspend", power_action_interactive);
|
|
|
14e627 |
break;
|
|
|
14e627 |
case HIBERNATE_KEY:
|
|
|
14e627 |
- do_config_power_action (manager, "button-hibernate", FALSE);
|
|
|
14e627 |
- break;
|
|
|
14e627 |
- case POWER_KEY_NO_DIALOG:
|
|
|
14e627 |
- do_config_power_action (manager, "button-power", TRUE);
|
|
|
14e627 |
- break;
|
|
|
14e627 |
- case SLEEP_KEY_NO_DIALOG:
|
|
|
14e627 |
- do_config_power_action (manager, "button-sleep", TRUE);
|
|
|
14e627 |
- break;
|
|
|
14e627 |
- case SUSPEND_KEY_NO_DIALOG:
|
|
|
14e627 |
- do_config_power_action (manager, "button-suspend", TRUE);
|
|
|
14e627 |
- break;
|
|
|
14e627 |
- case HIBERNATE_KEY_NO_DIALOG:
|
|
|
14e627 |
- do_config_power_action (manager, "button-hibernate", TRUE);
|
|
|
14e627 |
+ do_config_power_action (manager, "button-hibernate", power_action_interactive);
|
|
|
14e627 |
break;
|
|
|
14e627 |
case SCREEN_BRIGHTNESS_UP_KEY:
|
|
|
14e627 |
case SCREEN_BRIGHTNESS_DOWN_KEY:
|
|
|
14e627 |
@@ -2189,6 +2180,7 @@ on_accelerator_activated (ShellKeyGrabber *grabber,
|
|
|
14e627 |
guint i;
|
|
|
14e627 |
guint deviceid;
|
|
|
14e627 |
guint timestamp;
|
|
|
14e627 |
+ guint mode;
|
|
|
14e627 |
|
|
|
14e627 |
g_variant_dict_init (&dict, parameters);
|
|
|
14e627 |
|
|
|
14e627 |
@@ -2196,6 +2188,8 @@ on_accelerator_activated (ShellKeyGrabber *grabber,
|
|
|
14e627 |
deviceid = 0;
|
|
|
14e627 |
if (!g_variant_dict_lookup (&dict, "timestamp", "u", ×tamp))
|
|
|
14e627 |
timestamp = GDK_CURRENT_TIME;
|
|
|
14e627 |
+ if (!g_variant_dict_lookup (&dict, "action-mode", "u", &mode))
|
|
|
14e627 |
+ mode = 0;
|
|
|
14e627 |
|
|
|
14e627 |
for (i = 0; i < manager->priv->keys->len; i++) {
|
|
|
14e627 |
MediaKey *key;
|
|
|
14e627 |
@@ -2208,7 +2202,7 @@ on_accelerator_activated (ShellKeyGrabber *grabber,
|
|
|
14e627 |
if (key->key_type == CUSTOM_KEY)
|
|
|
14e627 |
do_custom_action (manager, deviceid, key, timestamp);
|
|
|
14e627 |
else
|
|
|
14e627 |
- do_action (manager, deviceid, key->key_type, timestamp);
|
|
|
14e627 |
+ do_action (manager, deviceid, mode, key->key_type, timestamp);
|
|
|
14e627 |
return;
|
|
|
14e627 |
}
|
|
|
14e627 |
}
|
|
|
14e627 |
diff --git a/plugins/media-keys/media-keys.h b/plugins/media-keys/media-keys.h
|
|
|
14e627 |
index dd1ffd2..970415b 100644
|
|
|
14e627 |
--- a/plugins/media-keys/media-keys.h
|
|
|
14e627 |
+++ b/plugins/media-keys/media-keys.h
|
|
|
14e627 |
@@ -72,10 +72,6 @@ typedef enum {
|
|
|
14e627 |
SLEEP_KEY,
|
|
|
14e627 |
SUSPEND_KEY,
|
|
|
14e627 |
HIBERNATE_KEY,
|
|
|
14e627 |
- POWER_KEY_NO_DIALOG,
|
|
|
14e627 |
- SLEEP_KEY_NO_DIALOG,
|
|
|
14e627 |
- SUSPEND_KEY_NO_DIALOG,
|
|
|
14e627 |
- HIBERNATE_KEY_NO_DIALOG,
|
|
|
14e627 |
SCREEN_BRIGHTNESS_UP_KEY,
|
|
|
14e627 |
SCREEN_BRIGHTNESS_DOWN_KEY,
|
|
|
14e627 |
KEYBOARD_BRIGHTNESS_UP_KEY,
|
|
|
14e627 |
diff --git a/plugins/media-keys/shortcuts-list.h b/plugins/media-keys/shortcuts-list.h
|
|
|
14e627 |
index de9fde2..a9958f1 100644
|
|
|
14e627 |
--- a/plugins/media-keys/shortcuts-list.h
|
|
|
14e627 |
+++ b/plugins/media-keys/shortcuts-list.h
|
|
|
14e627 |
@@ -28,11 +28,12 @@
|
|
|
14e627 |
SHELL_KEYBINDING_MODE_OVERVIEW)
|
|
|
14e627 |
#define SCREENSAVER_MODE SHELL_KEYBINDING_MODE_ALL & ~SHELL_KEYBINDING_MODE_UNLOCK_SCREEN
|
|
|
14e627 |
#define NO_LOCK_MODE SCREENSAVER_MODE & ~SHELL_KEYBINDING_MODE_LOCK_SCREEN
|
|
|
14e627 |
-#define POWER_KEYS_MODE (SHELL_KEYBINDING_MODE_NORMAL | \
|
|
|
14e627 |
- SHELL_KEYBINDING_MODE_OVERVIEW | \
|
|
|
14e627 |
- SHELL_KEYBINDING_MODE_LOGIN_SCREEN)
|
|
|
14e627 |
#define POWER_KEYS_MODE_NO_DIALOG (SHELL_KEYBINDING_MODE_LOCK_SCREEN | \
|
|
|
14e627 |
SHELL_KEYBINDING_MODE_UNLOCK_SCREEN)
|
|
|
14e627 |
+#define POWER_KEYS_MODE (SHELL_KEYBINDING_MODE_NORMAL | \
|
|
|
14e627 |
+ SHELL_KEYBINDING_MODE_OVERVIEW | \
|
|
|
14e627 |
+ SHELL_KEYBINDING_MODE_LOGIN_SCREEN |\
|
|
|
14e627 |
+ POWER_KEYS_MODE_NO_DIALOG)
|
|
|
14e627 |
|
|
|
14e627 |
static struct {
|
|
|
14e627 |
MediaKeyType key_type;
|
|
|
14e627 |
@@ -100,12 +101,6 @@ static struct {
|
|
|
14e627 |
{ SLEEP_KEY, NULL, N_("Sleep"), "XF86Suspend", POWER_KEYS_MODE },
|
|
|
14e627 |
{ SUSPEND_KEY, NULL, N_("Suspend"), "XF86Sleep", POWER_KEYS_MODE },
|
|
|
14e627 |
{ HIBERNATE_KEY, NULL, N_("Hibernate"), "XF86Hibernate", POWER_KEYS_MODE },
|
|
|
14e627 |
- { POWER_KEY_NO_DIALOG, NULL, N_("Power Off"), "XF86PowerOff", POWER_KEYS_MODE_NO_DIALOG },
|
|
|
14e627 |
- /* the kernel / Xorg names really are like this... */
|
|
|
14e627 |
- /* translators: "Sleep" means putting the machine to sleep, either through hibernate or suspend */
|
|
|
14e627 |
- { SLEEP_KEY_NO_DIALOG, NULL, N_("Sleep"), "XF86Suspend", POWER_KEYS_MODE_NO_DIALOG },
|
|
|
14e627 |
- { SUSPEND_KEY_NO_DIALOG, NULL, N_("Suspend"), "XF86Sleep", POWER_KEYS_MODE_NO_DIALOG },
|
|
|
14e627 |
- { HIBERNATE_KEY_NO_DIALOG, NULL, N_("Hibernate"), "XF86Hibernate", POWER_KEYS_MODE_NO_DIALOG },
|
|
|
14e627 |
{ SCREEN_BRIGHTNESS_UP_KEY, NULL, N_("Brightness Up"), "XF86MonBrightnessUp", SHELL_KEYBINDING_MODE_ALL },
|
|
|
14e627 |
{ SCREEN_BRIGHTNESS_DOWN_KEY, NULL, N_("Brightness Down"), "XF86MonBrightnessDown", SHELL_KEYBINDING_MODE_ALL },
|
|
|
14e627 |
{ KEYBOARD_BRIGHTNESS_UP_KEY, NULL, N_("Keyboard Brightness Up"), "XF86KbdBrightnessUp", SHELL_KEYBINDING_MODE_ALL },
|
|
|
14e627 |
--
|
|
|
14e627 |
2.3.6
|
|
|
14e627 |
|
|
|
14e627 |
|
|
|
14e627 |
From 89d8fa73f87f4a93f4fd328ca427d91cd6dfb562 Mon Sep 17 00:00:00 2001
|
|
|
14e627 |
From: Bastien Nocera <hadess@hadess.net>
|
|
|
14e627 |
Date: Wed, 1 Apr 2015 11:34:14 +0200
|
|
|
14e627 |
Subject: [PATCH 3/3] media-keys: Fix logic error when handling power keys
|
|
|
14e627 |
MIME-Version: 1.0
|
|
|
14e627 |
Content-Type: text/plain; charset=UTF-8
|
|
|
14e627 |
Content-Transfer-Encoding: 8bit
|
|
|
14e627 |
|
|
|
14e627 |
In the lock screen, means non-interactive action:
|
|
|
14e627 |
in_lock_screen == !power_action_interactive
|
|
|
14e627 |
|
|
|
14e627 |
Rename the variable to avoid having to invert it twice.
|
|
|
14e627 |
|
|
|
14e627 |
Spotted by Clément Guérin <geecko.dev@free.fr>
|
|
|
14e627 |
|
|
|
14e627 |
https://bugzilla.gnome.org/show_bug.cgi?id=746980
|
|
|
14e627 |
---
|
|
|
14e627 |
plugins/media-keys/gsd-media-keys-manager.c | 10 +++++-----
|
|
|
14e627 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
14e627 |
|
|
|
14e627 |
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
|
|
|
14e627 |
index 1108194..db14c7f 100644
|
|
|
14e627 |
--- a/plugins/media-keys/gsd-media-keys-manager.c
|
|
|
14e627 |
+++ b/plugins/media-keys/gsd-media-keys-manager.c
|
|
|
14e627 |
@@ -2020,7 +2020,7 @@ do_action (GsdMediaKeysManager *manager,
|
|
|
14e627 |
{
|
|
|
14e627 |
g_debug ("Launching action for key type '%d' (on device id %d)", type, deviceid);
|
|
|
14e627 |
|
|
|
14e627 |
- gboolean power_action_interactive = !(POWER_KEYS_MODE_NO_DIALOG & mode);
|
|
|
14e627 |
+ gboolean power_action_noninteractive = (POWER_KEYS_MODE_NO_DIALOG & mode);
|
|
|
14e627 |
|
|
|
14e627 |
switch (type) {
|
|
|
14e627 |
case TOUCHPAD_KEY:
|
|
|
14e627 |
@@ -2141,16 +2141,16 @@ do_action (GsdMediaKeysManager *manager,
|
|
|
14e627 |
do_toggle_contrast_action (manager);
|
|
|
14e627 |
break;
|
|
|
14e627 |
case POWER_KEY:
|
|
|
14e627 |
- do_config_power_action (manager, "button-power", power_action_interactive);
|
|
|
14e627 |
+ do_config_power_action (manager, "button-power", power_action_noninteractive);
|
|
|
14e627 |
break;
|
|
|
14e627 |
case SLEEP_KEY:
|
|
|
14e627 |
- do_config_power_action (manager, "button-sleep", power_action_interactive);
|
|
|
14e627 |
+ do_config_power_action (manager, "button-sleep", power_action_noninteractive);
|
|
|
14e627 |
break;
|
|
|
14e627 |
case SUSPEND_KEY:
|
|
|
14e627 |
- do_config_power_action (manager, "button-suspend", power_action_interactive);
|
|
|
14e627 |
+ do_config_power_action (manager, "button-suspend", power_action_noninteractive);
|
|
|
14e627 |
break;
|
|
|
14e627 |
case HIBERNATE_KEY:
|
|
|
14e627 |
- do_config_power_action (manager, "button-hibernate", power_action_interactive);
|
|
|
14e627 |
+ do_config_power_action (manager, "button-hibernate", power_action_noninteractive);
|
|
|
14e627 |
break;
|
|
|
14e627 |
case SCREEN_BRIGHTNESS_UP_KEY:
|
|
|
14e627 |
case SCREEN_BRIGHTNESS_DOWN_KEY:
|
|
|
14e627 |
--
|
|
|
14e627 |
2.3.6
|
|
|
14e627 |
|