[gnome-settings-daemon] media-keys: Show kbd-brigthness osd on org.gnome.SettingsDaemon.Power.Keyboard.BrightnessChanged sig
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] media-keys: Show kbd-brigthness osd on org.gnome.SettingsDaemon.Power.Keyboard.BrightnessChanged sig
- Date: Thu, 25 May 2017 13:48:53 +0000 (UTC)
commit eea459847d2ca459b170729a6f603d1544037588
Author: Hans de Goede <hdegoede redhat com>
Date: Sun Jan 29 14:05:30 2017 +0100
media-keys: Show kbd-brigthness osd on org.gnome.SettingsDaemon.Power.Keyboard.BrightnessChanged signal
If we receive an org.gnome.SettingsDaemon.Power.Keyboard.BrightnessChanged
signal and the source of the change is "internal", show the kbd-brigthness osd.
This makes the kbd-brigthness osd properly show up on laptops with
hardwired keyboard backlight brightness hotkeys (which don't emit
input events).
Note this requires an updated kernel [1] and upower [2] which actually emit
org.freedesktop.UPower.KbdBacklight.BrightnessChangedWithSource on such
laptops.
[1] https://patchwork.kernel.org/patch/9544111/
[2] https://bugs.freedesktop.org/show_bug.cgi?id=98404
https://bugzilla.gnome.org/show_bug.cgi?id=773405
plugins/media-keys/gsd-media-keys-manager.c | 28 +++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 33a42d4..d06a574 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -3160,6 +3160,30 @@ xrandr_ready_cb (GObject *source_object,
}
static void
+power_keyboard_proxy_signal_cb (GDBusProxy *proxy,
+ const gchar *sender_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
+{
+ GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data);
+ gint brightness;
+ const gchar *source;
+
+ if (g_strcmp0 (signal_name, "BrightnessChanged") != 0)
+ return;
+
+ g_variant_get (parameters, "(i&s)", &brightness, &source);
+
+ /* For non "internal" changes we already show the osd when handling
+ * the hotkey causing the change. */
+ if (g_strcmp0 (source, "internal") != 0)
+ return;
+
+ show_osd (manager, "keyboard-brightness-symbolic", NULL, brightness, -1);
+}
+
+static void
power_ready_cb (GObject *source_object,
GAsyncResult *res,
GsdMediaKeysManager *manager)
@@ -3205,6 +3229,10 @@ power_keyboard_ready_cb (GObject *source_object,
error->message);
g_error_free (error);
}
+
+ g_signal_connect (manager->priv->power_keyboard_proxy, "g-signal",
+ G_CALLBACK (power_keyboard_proxy_signal_cb),
+ manager);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]