mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-23 04:38:11 +02:00
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
This commit is contained in:
parent
12d34b8a8b
commit
112814fd4f
2 changed files with 39 additions and 2 deletions
|
|
@ -96,6 +96,34 @@
|
|||
</doc:doc>
|
||||
</signal>
|
||||
|
||||
<signal name="BrightnessChangedWithSource">
|
||||
<arg name="value" direction="out" type="i">
|
||||
<doc:doc>
|
||||
<doc:summary>
|
||||
The new brightness value of the keyboard backlight.
|
||||
</doc:summary>
|
||||
</doc:doc>
|
||||
</arg>
|
||||
<arg name="source" direction="out" type="s">
|
||||
<doc:doc>
|
||||
<doc:summary>
|
||||
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).
|
||||
</doc:summary>
|
||||
</doc:doc>
|
||||
</arg>
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
The keyboard backlight brightness level has changed including
|
||||
information about the source of the change.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
</signal>
|
||||
|
||||
</interface>
|
||||
|
||||
</node>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,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:
|
||||
**/
|
||||
|
|
@ -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, "external");
|
||||
|
||||
out:
|
||||
g_free (text);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue