From 110850248373b1d6280dbe36bb6d17ee0c6f1997 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 5 Feb 2017 16:04:02 +0100 Subject: [PATCH] UpKbdBacklight: Add new BrightnessChangedWithSource signal There are multiple possible causes for the keyboard brightness to change, e.g. SetBrightness may get called, or the brightness may get changed through a hotkey which is handled in firmware. https://bugs.freedesktop.org/show_bug.cgi?id=98404 --- dbus/org.freedesktop.UPower.KbdBacklight.xml | 28 ++++++++++++++++++++++++++++ src/up-kbd-backlight.c | 13 +++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/dbus/org.freedesktop.UPower.KbdBacklight.xml b/dbus/org.freedesktop.UPower.KbdBacklight.xml index 994380f..6a7c2c6 100644 --- a/dbus/org.freedesktop.UPower.KbdBacklight.xml +++ b/dbus/org.freedesktop.UPower.KbdBacklight.xml @@ -96,6 +96,34 @@ + + + + + The new brightness value of the keyboard backlight. + + + + + + + Source of the keyboard backlight brightness change, either + "external" if SetBrightness was called, or "internal" if the + hardware changed the keyboard brightness itself (automatically or + through a firmware-handled hotkey being pressed). + + + + + + + The keyboard backlight brightness level has changed including + information about the source of the change. + + + + + diff --git a/src/up-kbd-backlight.c b/src/up-kbd-backlight.c index 925a5ed..f693983 100644 --- a/src/up-kbd-backlight.c +++ b/src/up-kbd-backlight.c @@ -49,6 +49,16 @@ struct UpKbdBacklightPrivate G_DEFINE_TYPE (UpKbdBacklight, up_kbd_backlight, UP_TYPE_EXPORTED_KBD_BACKLIGHT_SKELETON) /** + * up_kbd_backlight_emit_change: + **/ +static void +up_kbd_backlight_emit_change(UpKbdBacklight *kbd_backlight, int value, const char *source) +{ + up_exported_kbd_backlight_emit_brightness_changed (UP_EXPORTED_KBD_BACKLIGHT (kbd_backlight), value); + up_exported_kbd_backlight_emit_brightness_changed_with_source (UP_EXPORTED_KBD_BACKLIGHT (kbd_backlight), value, source); +} + +/** * up_kbd_backlight_brightness_read: **/ static gint @@ -114,8 +124,7 @@ up_kbd_backlight_brightness_write (UpKbdBacklight *kbd_backlight, gint value) } /* emit signal */ - up_exported_kbd_backlight_emit_brightness_changed (UP_EXPORTED_KBD_BACKLIGHT (kbd_backlight), - value); + up_kbd_backlight_emit_change (kbd_backlight, value, "SetBrightness"); out: g_free (text); -- 2.9.3