summaryrefslogtreecommitdiff
path: root/src/lib/elput/elput_evdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elput/elput_evdev.c')
-rw-r--r--src/lib/elput/elput_evdev.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 222c5087a2..b041bb6785 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -38,9 +38,25 @@ _seat_frame_send(Elput_Seat *seat)
38} 38}
39 39
40static void 40static void
41_evdev_leds_update(Elput_Device *edev, Elput_Leds leds)
42{
43 enum libinput_led input_leds = 0;
44
45 if (leds & ELPUT_LED_NUM)
46 input_leds |= LIBINPUT_LED_NUM_LOCK;
47 if (leds & ELPUT_LED_CAPS)
48 input_leds |= LIBINPUT_LED_CAPS_LOCK;
49 if (leds & ELPUT_LED_SCROLL)
50 input_leds |= LIBINPUT_LED_SCROLL_LOCK;
51
52 libinput_device_led_update(edev->device, input_leds);
53}
54
55static void
41_keyboard_modifiers_update(Elput_Keyboard *kbd, Elput_Seat *seat) 56_keyboard_modifiers_update(Elput_Keyboard *kbd, Elput_Seat *seat)
42{ 57{
43 xkb_mod_mask_t mask; 58 xkb_mod_mask_t mask;
59 Elput_Leds leds = 0;
44 60
45 kbd->mods.depressed = 61 kbd->mods.depressed =
46 xkb_state_serialize_mods(kbd->state, XKB_STATE_DEPRESSED); 62 xkb_state_serialize_mods(kbd->state, XKB_STATE_DEPRESSED);
@@ -64,6 +80,26 @@ _keyboard_modifiers_update(Elput_Keyboard *kbd, Elput_Seat *seat)
64 seat->modifiers |= ECORE_EVENT_MODIFIER_WIN; 80 seat->modifiers |= ECORE_EVENT_MODIFIER_WIN;
65 if (mask & kbd->info->mods.altgr) 81 if (mask & kbd->info->mods.altgr)
66 seat->modifiers |= ECORE_EVENT_MODIFIER_ALTGR; 82 seat->modifiers |= ECORE_EVENT_MODIFIER_ALTGR;
83
84 if (xkb_state_led_index_is_active(kbd->state, kbd->info->leds.num))
85 leds |= ELPUT_LED_NUM;
86
87 if (xkb_state_led_index_is_active(kbd->state, kbd->info->leds.caps))
88 leds |= ELPUT_LED_CAPS;
89
90 if (xkb_state_led_index_is_active(kbd->state, kbd->info->leds.scroll))
91 leds |= ELPUT_LED_SCROLL;
92
93 if (kbd->leds != leds)
94 {
95 Eina_List *l;
96 Elput_Device *edev;
97
98 EINA_LIST_FOREACH(seat->devices, l, edev)
99 _evdev_leds_update(edev, leds);
100
101 kbd->leds = leds;
102 }
67} 103}
68 104
69static Elput_Keyboard_Info * 105static Elput_Keyboard_Info *
@@ -90,6 +126,13 @@ _keyboard_info_create(struct xkb_keymap *keymap)
90 info->mods.altgr = 126 info->mods.altgr =
91 1 << xkb_keymap_mod_get_index(info->keymap.map, "ISO_Level3_Shift"); 127 1 << xkb_keymap_mod_get_index(info->keymap.map, "ISO_Level3_Shift");
92 128
129 info->leds.num =
130 xkb_keymap_led_get_index(info->keymap.map, XKB_LED_NAME_NUM);
131 info->leds.caps =
132 xkb_keymap_led_get_index(info->keymap.map, XKB_LED_NAME_CAPS);
133 info->leds.scroll =
134 xkb_keymap_led_get_index(info->keymap.map, XKB_LED_NAME_SCROLL);
135
93 return info; 136 return info;
94} 137}
95 138