forked from enlightenment/efl
elput: Fix support for setting keyboard led(s)
Small patch to update keyboard led(s) when caps, numlock, etc are pressed. This patch adds some fields to internal (non-API exposed) structures inside our private header (of a BETA-API library) and thus should still be ok during freeze. Fixes T5655 @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
4052923ed0
commit
8fdb4e0d8d
|
@ -37,10 +37,26 @@ _seat_frame_send(Elput_Seat *seat)
|
|||
ecore_event_add(ELPUT_EVENT_SEAT_FRAME, ev, _seat_event_free, seat);
|
||||
}
|
||||
|
||||
static void
|
||||
_evdev_leds_update(Elput_Device *edev, Elput_Leds leds)
|
||||
{
|
||||
enum libinput_led input_leds = 0;
|
||||
|
||||
if (leds & ELPUT_LED_NUM)
|
||||
input_leds |= LIBINPUT_LED_NUM_LOCK;
|
||||
if (leds & ELPUT_LED_CAPS)
|
||||
input_leds |= LIBINPUT_LED_CAPS_LOCK;
|
||||
if (leds & ELPUT_LED_SCROLL)
|
||||
input_leds |= LIBINPUT_LED_SCROLL_LOCK;
|
||||
|
||||
libinput_device_led_update(edev->device, input_leds);
|
||||
}
|
||||
|
||||
static void
|
||||
_keyboard_modifiers_update(Elput_Keyboard *kbd, Elput_Seat *seat)
|
||||
{
|
||||
xkb_mod_mask_t mask;
|
||||
Elput_Leds leds = 0;
|
||||
|
||||
kbd->mods.depressed =
|
||||
xkb_state_serialize_mods(kbd->state, XKB_STATE_DEPRESSED);
|
||||
|
@ -64,6 +80,26 @@ _keyboard_modifiers_update(Elput_Keyboard *kbd, Elput_Seat *seat)
|
|||
seat->modifiers |= ECORE_EVENT_MODIFIER_WIN;
|
||||
if (mask & kbd->info->mods.altgr)
|
||||
seat->modifiers |= ECORE_EVENT_MODIFIER_ALTGR;
|
||||
|
||||
if (xkb_state_led_index_is_active(kbd->state, kbd->info->leds.num))
|
||||
leds |= ELPUT_LED_NUM;
|
||||
|
||||
if (xkb_state_led_index_is_active(kbd->state, kbd->info->leds.caps))
|
||||
leds |= ELPUT_LED_CAPS;
|
||||
|
||||
if (xkb_state_led_index_is_active(kbd->state, kbd->info->leds.scroll))
|
||||
leds |= ELPUT_LED_SCROLL;
|
||||
|
||||
if (kbd->leds != leds)
|
||||
{
|
||||
Eina_List *l;
|
||||
Elput_Device *edev;
|
||||
|
||||
EINA_LIST_FOREACH(seat->devices, l, edev)
|
||||
_evdev_leds_update(edev, leds);
|
||||
|
||||
kbd->leds = leds;
|
||||
}
|
||||
}
|
||||
|
||||
static Elput_Keyboard_Info *
|
||||
|
@ -90,6 +126,13 @@ _keyboard_info_create(struct xkb_keymap *keymap)
|
|||
info->mods.altgr =
|
||||
1 << xkb_keymap_mod_get_index(info->keymap.map, "ISO_Level3_Shift");
|
||||
|
||||
info->leds.num =
|
||||
xkb_keymap_led_get_index(info->keymap.map, XKB_LED_NAME_NUM);
|
||||
info->leds.caps =
|
||||
xkb_keymap_led_get_index(info->keymap.map, XKB_LED_NAME_CAPS);
|
||||
info->leds.scroll =
|
||||
xkb_keymap_led_get_index(info->keymap.map, XKB_LED_NAME_SCROLL);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,13 @@ typedef struct _Elput_Input
|
|||
Eina_Bool suspended : 1;
|
||||
} Elput_Input;
|
||||
|
||||
typedef enum _Elput_Leds
|
||||
{
|
||||
ELPUT_LED_NUM = (1 << 0),
|
||||
ELPUT_LED_CAPS = (1 << 1),
|
||||
ELPUT_LED_SCROLL = (1 << 2)
|
||||
} Elput_Leds;
|
||||
|
||||
typedef struct _Elput_Keyboard_Info
|
||||
{
|
||||
int refs;
|
||||
|
@ -104,6 +111,13 @@ typedef struct _Elput_Keyboard_Info
|
|||
xkb_mod_index_t altgr;
|
||||
xkb_mod_index_t super;
|
||||
} mods;
|
||||
|
||||
struct
|
||||
{
|
||||
xkb_led_index_t num;
|
||||
xkb_led_index_t caps;
|
||||
xkb_led_index_t scroll;
|
||||
} leds;
|
||||
} Elput_Keyboard_Info;
|
||||
|
||||
struct _Elput_Keyboard
|
||||
|
@ -132,6 +146,8 @@ struct _Elput_Keyboard
|
|||
struct xkb_compose_table *compose_table;
|
||||
struct xkb_compose_state *compose_state;
|
||||
|
||||
Elput_Leds leds;
|
||||
|
||||
Elput_Seat *seat;
|
||||
|
||||
Eina_Bool pending_keymap : 1;
|
||||
|
@ -295,6 +311,6 @@ extern Elput_Interface _logind_interface;
|
|||
void _keyboard_keymap_update(Elput_Seat *seat);
|
||||
void _keyboard_group_update(Elput_Seat *seat);
|
||||
|
||||
|
||||
void _udev_seat_destroy(Elput_Seat *eseat);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue