[gnome-settings-daemon] media-keys: Wait forever for GrabAccelerators() to succeed
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] media-keys: Wait forever for GrabAccelerators() to succeed
- Date: Sat, 31 Mar 2018 17:16:57 +0000 (UTC)
commit 05f168842f4754fa409029651842e9333f75fe05
Author: Mantas Mikulėnas <grawity gmail com>
Date: Mon Feb 5 10:57:00 2018 +0200
media-keys: Wait forever for GrabAccelerators() to succeed
On slower machines (esp. with tracker and/or dropbox starting on login)
this may take more than the usual timeout of ~25 seconds.
We cannot use the existing retry loop here – in this bug, the first call
actually *succeeds* from gnome-shell's side, even if gsd-mediakeys gives
up on waiting for the reply.
So if we called GrabAccelerators again, we would receive no accel IDs
(because all keys are duplicates), and gnome-shell would keep sending
AcceleratorActivated signals with accel IDs that the 1st call has
established – resulting in exactly the same "Could not find accelerator
for accel id" as we're trying to fix.
https://bugzilla.gnome.org/show_bug.cgi?id=792353
plugins/media-keys/gsd-media-keys-manager.c | 22 ++++++++++++++--------
plugins/media-keys/org.gnome.ShellKeyGrabber.xml | 4 ----
2 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 2e1a64a9..1b3ff38d 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -80,6 +80,7 @@
#define CUSTOM_BINDING_SCHEMA SETTINGS_BINDING_DIR ".custom-keybinding"
+#define SHELL_GRABBER_CALL_TIMEOUT G_MAXINT
#define SHELL_GRABBER_RETRY_INTERVAL 1
#define OSD_ALL_OUTPUTS -1
@@ -435,13 +436,14 @@ grab_accelerators_complete (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- GVariant *actions;
+ GVariant *ret, *actions;
gboolean retry = FALSE;
GError *error = NULL;
GsdMediaKeysManager *manager = user_data;
- shell_key_grabber_call_grab_accelerators_finish (SHELL_KEY_GRABBER (object),
- &actions, result, &error);
+ ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), result, &error);
+ g_variant_get (ret, "(@au)", &actions);
+ g_variant_unref (ret);
if (error) {
retry = g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
@@ -486,11 +488,15 @@ grab_media_keys (GsdMediaKeysManager *manager)
g_free (tmp);
}
- shell_key_grabber_call_grab_accelerators (manager->priv->key_grabber,
- g_variant_builder_end (&builder),
- manager->priv->grab_cancellable,
- grab_accelerators_complete,
- manager);
+ g_dbus_proxy_call (G_DBUS_PROXY (manager->priv->key_grabber),
+ "GrabAccelerators",
+ g_variant_new ("(@a(su))",
+ g_variant_builder_end (&builder)),
+ G_DBUS_CALL_FLAGS_NONE,
+ SHELL_GRABBER_CALL_TIMEOUT,
+ manager->priv->grab_cancellable,
+ grab_accelerators_complete,
+ manager);
}
static void
diff --git a/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
b/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
index a245481a..4a1f7e7d 100644
--- a/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
+++ b/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
@@ -6,10 +6,6 @@
<arg type="u" direction="in" name="flags"/>
<arg type="u" direction="out" name="action"/>
</method>
- <method name="GrabAccelerators">
- <arg type="a(su)" direction="in" name="accelerators"/>
- <arg type="au" direction="out" name="actions"/>
- </method>
<method name="UngrabAccelerator">
<arg type="u" direction="in" name="action"/>
<arg type="b" direction="out" name="success"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]