1
0
Fork 0
forked from wry/wry

metal: enable keyboard LEDs

This commit is contained in:
Julian Orth 2025-09-07 12:09:43 +02:00
parent 0e51b9469b
commit 11c10fde70
14 changed files with 188 additions and 22 deletions

View file

@ -33,6 +33,8 @@ cenum! {
LIBINPUT_LED_NUM_LOCK = 1 << 0,
LIBINPUT_LED_CAPS_LOCK = 1 << 1,
LIBINPUT_LED_SCROLL_LOCK = 1 << 2,
LIBINPUT_LED_COMPOSE = 1 << 3,
LIBINPUT_LED_KANA = 1 << 4,
}
cenum! {

View file

@ -7,7 +7,7 @@ use {
LIBINPUT_CONFIG_DRAG_DISABLED, LIBINPUT_CONFIG_DRAG_ENABLED,
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED, LIBINPUT_CONFIG_DRAG_LOCK_ENABLED,
LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED,
LIBINPUT_CONFIG_TAP_DISABLED, LIBINPUT_CONFIG_TAP_ENABLED,
LIBINPUT_CONFIG_TAP_DISABLED, LIBINPUT_CONFIG_TAP_ENABLED, Led,
},
sys::{
libinput_device, libinput_device_config_accel_get_profile,
@ -36,8 +36,9 @@ use {
libinput_device_get_id_vendor, libinput_device_get_name, libinput_device_get_user_data,
libinput_device_group, libinput_device_group_get_user_data,
libinput_device_group_set_user_data, libinput_device_has_capability,
libinput_device_set_user_data, libinput_device_tablet_pad_get_mode_group,
libinput_device_tablet_pad_get_num_buttons, libinput_device_tablet_pad_get_num_dials,
libinput_device_led_update, libinput_device_set_user_data,
libinput_device_tablet_pad_get_mode_group, libinput_device_tablet_pad_get_num_buttons,
libinput_device_tablet_pad_get_num_dials,
libinput_device_tablet_pad_get_num_mode_groups,
libinput_device_tablet_pad_get_num_rings, libinput_device_tablet_pad_get_num_strips,
libinput_device_unref, libinput_path_remove_device, libinput_tablet_pad_mode_group,
@ -343,6 +344,12 @@ impl<'a> LibInputDevice<'a> {
}
[[m[0], m[1], m[2]], [m[3], m[4], m[5]]]
}
pub fn led_update(&self, led: Led) {
unsafe {
libinput_device_led_update(self.dev, led.raw() as _);
}
}
}
impl<'a> LibInputDeviceGroup<'a> {

View file

@ -410,6 +410,8 @@ unsafe extern "C" {
device: *mut libinput_device,
matrix: *mut [f32; 6],
) -> c::c_int;
pub fn libinput_device_led_update(device: *mut libinput_device, leds: libinput_led);
}
#[repr(C)]