summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMantas Mikulėnas <grawity@gmail.com>2018-02-05 10:57:00 +0200
committerBastien Nocera <hadess@hadess.net>2018-03-31 19:19:57 +0200
commitedf9a98632b7cb752018207de7a5a25c4258bac3 (patch)
tree4a7775d942573319be902b3b17a97796ce7ea91e
parent7902301a96b78f17a1d584a3cdf1981664d6e7b5 (diff)
downloadgnome-settings-daemon-gnome-3-26.tar.gz
media-keys: Wait forever for GrabAccelerators() to succeedgnome-3-26
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
-rw-r--r--plugins/media-keys/gsd-media-keys-manager.c22
-rw-r--r--plugins/media-keys/org.gnome.ShellKeyGrabber.xml4
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 9a8070e5..cb9f70a1 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"/>