Dominique Leuenberger
f9ff00db71
OBS-URL: https://build.opensuse.org/request/show/593428 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-settings-daemon?expand=0&rev=323
94 lines
4.1 KiB
Diff
94 lines
4.1 KiB
Diff
From 05f168842f4754fa409029651842e9333f75fe05 Mon Sep 17 00:00:00 2001
|
||
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
|
||
Date: Mon, 5 Feb 2018 10:57:00 +0200
|
||
Subject: [PATCH] media-keys: Wait forever for GrabAccelerators() to succeed
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
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(-)
|
||
|
||
Index: b/plugins/media-keys/gsd-media-keys-manager.c
|
||
===================================================================
|
||
--- a/plugins/media-keys/gsd-media-keys-manager.c 2018-04-04 12:50:14.469324589 +0800
|
||
+++ b/plugins/media-keys/gsd-media-keys-manager.c 2018-04-04 12:50:33.937584284 +0800
|
||
@@ -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
|
||
|
||
@@ -427,13 +428,14 @@
|
||
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 = (error->code == G_DBUS_ERROR_UNKNOWN_METHOD);
|
||
@@ -478,11 +480,15 @@
|
||
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
|
||
Index: b/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
|
||
===================================================================
|
||
--- a/plugins/media-keys/org.gnome.ShellKeyGrabber.xml 2018-04-04 12:50:14.469324589 +0800
|
||
+++ b/plugins/media-keys/org.gnome.ShellKeyGrabber.xml 2018-04-04 12:50:33.937584284 +0800
|
||
@@ -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"/>
|