Khurshid Alam has proposed merging
lp:~khurshid-alam/unity-settings-daemon/media-keys-fix into
lp:unity-settings-daemon.
Commit message:
* media-keys: Add more debug info
This backports commits dc13b2d, 5f01643 & a09ae56 from gnome-settings-daemon.
* media-keys: Fix cancelled async calls usage
This backports commits 86cbfda + 5147e6b & 214145c from gnome-settings-daemon.
* DESKTOP_SESSION is now unity
Unity uses legacy key-grabber code. But since artful unity isn't the default
session anymore and
DESKTOP_SESSION changed from ubuntu to unity. Fixes LP: #1755106 LP: #1188569
LP: #1727842
Requested reviews:
Unity Settings Daemon Development Team (unity-settings-daemon-team)
Related bugs:
Bug #1188569 in unity (Ubuntu): "Some keyboard shortcuts randomly stop
working"
https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1188569
Bug #1727842 in unity (Ubuntu): "Volume and Mute buttons on keyboard not
doing anything in Unity after upgrade to 17.10"
https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1727842
Bug #1755106 in unity-settings-daemon (Ubuntu):
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/ fails to
load"
https://bugs.launchpad.net/ubuntu/+source/unity-settings-daemon/+bug/1755106
For more details, see:
https://code.launchpad.net/~khurshid-alam/unity-settings-daemon/media-keys-fix/+merge/359935
It may seem unnecessary to add debug info for each dbus method call (revno:
4187), but I noticed session name change only after I added the debug info in
the first place. Beside I don't want to partially backport commit for no
reason. They do no harm.
And since I have other fixes just for media-key plugin, this will keep size of
each MR & no of MRs short.
--
Your team Unity Settings Daemon Development Team is requested to review the
proposed merge of lp:~khurshid-alam/unity-settings-daemon/media-keys-fix into
lp:unity-settings-daemon.
=== modified file 'plugins/media-keys/gsd-media-keys-manager.c'
--- plugins/media-keys/gsd-media-keys-manager.c 2017-10-03 05:07:39 +0000
+++ plugins/media-keys/gsd-media-keys-manager.c 2018-11-30 16:30:16 +0000
@@ -223,7 +223,7 @@
GDBusConnection *connection;
GCancellable *bus_cancellable;
GDBusProxy *xrandr_proxy;
- GCancellable *cancellable;
+ GCancellable *cancellable; /* Only used for XRandR operations */
guint start_idle_id;
@@ -699,6 +699,7 @@
{
GsdMediaKeysManager *manager = data;
+ g_debug ("Retrying to grab accelerators");
grab_media_keys (manager);
return FALSE;
}
@@ -718,8 +719,10 @@
if (error) {
retry = (error->code == G_DBUS_ERROR_UNKNOWN_METHOD);
- if (!retry)
- g_warning ("%d: %s", error->code, error->message);
+ if (!retry && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Failed to grab accelerators: %s (%d)", error->message, error->code);
+ else if (retry)
+ g_debug ("Failed to grab accelerators, will retry: %s (%d)", error->message, error->code);
g_error_free (error);
} else {
int i;
@@ -768,9 +771,14 @@
{
GrabData *data = user_data;
MediaKey *key = data->key;
+ GError *error = NULL;
- shell_key_grabber_call_grab_accelerator_finish (SHELL_KEY_GRABBER (object),
- &key->accel_id, result, NULL);
+ if (!shell_key_grabber_call_grab_accelerator_finish (SHELL_KEY_GRABBER (object),
+ &key->accel_id, result, &error)) {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Failed to grab accelerator: %s", error->message);
+ g_error_free (error);
+ }
g_slice_free (GrabData, data);
}
@@ -838,8 +846,14 @@
gpointer user_data)
{
GsdMediaKeysManager *manager = user_data;
- shell_key_grabber_call_ungrab_accelerator_finish (SHELL_KEY_GRABBER (object),
- NULL, result, NULL);
+
+ GError *error = NULL;
+ if (!shell_key_grabber_call_ungrab_accelerator_finish (SHELL_KEY_GRABBER (object),
+ NULL, result, &error)) {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Failed to ungrab accelerator: %s", error->message);
+ g_error_free (error);
+ }
}
static void
@@ -1390,7 +1404,7 @@
priv->screen_saver_proxy = gnome_settings_bus_get_screen_saver_proxy ();
gsd_screen_saver_call_lock (priv->screen_saver_proxy,
- priv->cancellable,
+ priv->bus_cancellable,
(GAsyncReadyCallback) on_screen_locked,
manager);
}
@@ -2005,7 +2019,8 @@
manager->priv->cancellable = NULL;
if (error != NULL) {
- g_warning ("Unable to call '%s': %s", action, error->message);
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Failed to complete XRandR action: %s", error->message);
g_error_free (error);
} else {
g_variant_unref (variant);
@@ -2275,7 +2290,7 @@
guint first;
gint i, n;
- if (g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "ubuntu") != 0)
+ if (g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "unity") != 0)
if (!priv->have_legacy_keygrabber)
return;
@@ -2817,6 +2832,9 @@
{
guint i;
+ g_debug ("Received accel id %u (device-id: %u, timestamp: %u",
+ accel_id, deviceid, timestamp);
+
for (i = 0; i < manager->priv->keys->len; i++) {
MediaKey *key;
@@ -2831,6 +2849,8 @@
do_action (manager, deviceid, key->key_type, timestamp);
return;
}
+
+ g_warning ("Could not find accelerator for accel id %u", accel_id);
}
static void
@@ -2962,12 +2982,17 @@
gpointer data)
{
GsdMediaKeysManager *manager = data;
+ GError *error = NULL;
manager->priv->key_grabber =
- shell_key_grabber_proxy_new_for_bus_finish (result, NULL);
+ shell_key_grabber_proxy_new_for_bus_finish (result, &error);
- if (!manager->priv->key_grabber)
+ if (!manager->priv->key_grabber) {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Failed to create proxy for key grabber: %s", error->message);
+ g_error_free (error);
return;
+ }
g_signal_connect (manager->priv->key_grabber, "accelerator-activated",
G_CALLBACK (on_accelerator_activated), manager);
@@ -2979,7 +3004,7 @@
session_has_key_grabber (void)
{
const gchar *session = g_getenv ("DESKTOP_SESSION");
- return g_strcmp0 (session, "gnome") == 0 || g_strcmp0 (session, "ubuntu") == 0;
+ return g_strcmp0 (session, "gnome") == 0 || g_strcmp0 (session, "unity") == 0;
}
static void
@@ -3379,7 +3404,8 @@
res = g_dbus_proxy_call_with_unix_fd_list_finish (proxy, &fd_list, result, &error);
if (res == NULL) {
- g_warning ("Unable to inhibit keypresses: %s", error->message);
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Unable to inhibit keypresses: %s", error->message);
g_error_free (error);
} else {
g_variant_get (res, "(h)", &idx);
@@ -3478,7 +3504,8 @@
manager->priv->xrandr_proxy = g_dbus_proxy_new_finish (res, &error);
if (manager->priv->xrandr_proxy == NULL) {
- g_warning ("Failed to get proxy for XRandR operations: %s", error->message);
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Failed to get proxy for XRandR operations: %s", error->message);
g_error_free (error);
}
}
@@ -3492,8 +3519,9 @@
manager->priv->power_proxy = g_dbus_proxy_new_finish (res, &error);
if (manager->priv->power_proxy == NULL) {
- g_warning ("Failed to get proxy for power: %s",
- error->message);
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Failed to get proxy for power: %s",
+ error->message);
g_error_free (error);
}
}
@@ -3507,8 +3535,9 @@
manager->priv->power_screen_proxy = g_dbus_proxy_new_finish (res, &error);
if (manager->priv->power_screen_proxy == NULL) {
- g_warning ("Failed to get proxy for power (screen): %s",
- error->message);
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Failed to get proxy for power (screen): %s",
+ error->message);
g_error_free (error);
}
}
@@ -3522,8 +3551,9 @@
manager->priv->power_keyboard_proxy = g_dbus_proxy_new_finish (res, &error);
if (manager->priv->power_keyboard_proxy == NULL) {
- g_warning ("Failed to get proxy for power (keyboard): %s",
- error->message);
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Failed to get proxy for power (keyboard): %s",
+ error->message);
g_error_free (error);
}
}
@@ -3536,15 +3566,11 @@
GDBusConnection *connection;
GError *error = NULL;
- if (manager->priv->bus_cancellable == NULL ||
- g_cancellable_is_cancelled (manager->priv->bus_cancellable)) {
- g_warning ("Operation has been cancelled, so not retrieving session bus");
- return;
- }
connection = g_bus_get_finish (res, &error);
if (connection == NULL) {
- g_warning ("Could not get session bus: %s", error->message);
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Could not get session bus: %s", error->message);
g_error_free (error);
return;
}
--
ubuntu-desktop mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop