summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-08-18 15:24:51 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-08-18 15:24:37 -0400
commitdc073c1ea343e626e3a3a809245308034ed86f5e (patch)
treecab35cb19c0b197c458ce158148ce791706430e1
parentdae39821d9b4fa463861a8a4cada4afbf8004834 (diff)
wayland: fix num/caps lock handling in events
locks are not the same as modifiers, and the corresponding event flag must be set based on whichever value(s) are set instead of yolo mixing and matching @fix ref T5737
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c13
-rw-r--r--src/lib/elput/elput_evdev.c9
-rw-r--r--src/lib/elput/elput_private.h1
3 files changed, 21 insertions, 2 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c
index da6fe7cd59..d20849eda2 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -1152,14 +1152,23 @@ _keyboard_cb_modifiers(void *data, struct wl_keyboard *keyboard EINA_UNUSED, uns
1152 input->keyboard.modifiers |= ECORE_EVENT_MODIFIER_SHIFT; 1152 input->keyboard.modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
1153 if (mask & input->xkb.win_mask) 1153 if (mask & input->xkb.win_mask)
1154 input->keyboard.modifiers |= ECORE_EVENT_MODIFIER_WIN; 1154 input->keyboard.modifiers |= ECORE_EVENT_MODIFIER_WIN;
1155 if (mask & input->xkb.altgr_mask)
1156 input->keyboard.modifiers |= ECORE_EVENT_MODIFIER_ALTGR;
1157 if (mask & input->xkb.scroll_mask)
1158 input->keyboard.modifiers |= ECORE_EVENT_MODIFIER_SCROLL;
1159 if (mask & input->xkb.num_mask)
1160 input->keyboard.modifiers |= ECORE_EVENT_MODIFIER_NUM;
1161 if (mask & input->xkb.caps_mask)
1162 input->keyboard.modifiers |= ECORE_EVENT_MODIFIER_CAPS;
1163
1164
1165 mask = xkb_state_serialize_mods(input->xkb.state, XKB_STATE_MODS_LOCKED);
1155 if (mask & input->xkb.scroll_mask) 1166 if (mask & input->xkb.scroll_mask)
1156 input->keyboard.modifiers |= ECORE_EVENT_LOCK_SCROLL; 1167 input->keyboard.modifiers |= ECORE_EVENT_LOCK_SCROLL;
1157 if (mask & input->xkb.num_mask) 1168 if (mask & input->xkb.num_mask)
1158 input->keyboard.modifiers |= ECORE_EVENT_LOCK_NUM; 1169 input->keyboard.modifiers |= ECORE_EVENT_LOCK_NUM;
1159 if (mask & input->xkb.caps_mask) 1170 if (mask & input->xkb.caps_mask)
1160 input->keyboard.modifiers |= ECORE_EVENT_LOCK_CAPS; 1171 input->keyboard.modifiers |= ECORE_EVENT_LOCK_CAPS;
1161 if (mask & input->xkb.altgr_mask)
1162 input->keyboard.modifiers |= ECORE_EVENT_MODIFIER_ALTGR;
1163} 1172}
1164 1173
1165static void 1174static void
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 1199a09798..09d75932f8 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -82,6 +82,13 @@ _keyboard_modifiers_update(Elput_Keyboard *kbd, Elput_Seat *seat)
82 seat->modifiers |= ECORE_EVENT_MODIFIER_ALTGR; 82 seat->modifiers |= ECORE_EVENT_MODIFIER_ALTGR;
83 if (mask & kbd->info->mods.caps) 83 if (mask & kbd->info->mods.caps)
84 seat->modifiers |= ECORE_EVENT_MODIFIER_CAPS; 84 seat->modifiers |= ECORE_EVENT_MODIFIER_CAPS;
85 if (mask & kbd->info->mods.num)
86 seat->modifiers |= ECORE_EVENT_MODIFIER_NUM;
87
88 if (kbd->mods.locked & kbd->info->mods.caps)
89 seat->modifiers |= ECORE_EVENT_LOCK_CAPS;
90 if (kbd->mods.locked & kbd->info->mods.num)
91 seat->modifiers |= ECORE_EVENT_LOCK_NUM;
85 92
86 if (xkb_state_led_index_is_active(kbd->state, kbd->info->leds.num)) 93 if (xkb_state_led_index_is_active(kbd->state, kbd->info->leds.num))
87 leds |= ELPUT_LED_NUM; 94 leds |= ELPUT_LED_NUM;
@@ -121,6 +128,8 @@ _keyboard_info_create(struct xkb_keymap *keymap)
121 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_SHIFT); 128 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_SHIFT);
122 info->mods.caps = 129 info->mods.caps =
123 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_CAPS); 130 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_CAPS);
131 info->mods.num =
132 1 << xkb_keymap_mod_get_index(info->keymap.map, "Mod2");
124 info->mods.ctrl = 133 info->mods.ctrl =
125 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_CTRL); 134 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_CTRL);
126 info->mods.alt = 135 info->mods.alt =
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index f5bc425182..a4ea37b8a1 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -106,6 +106,7 @@ typedef struct _Elput_Keyboard_Info
106 { 106 {
107 xkb_mod_index_t shift; 107 xkb_mod_index_t shift;
108 xkb_mod_index_t caps; 108 xkb_mod_index_t caps;
109 xkb_mod_index_t num;
109 xkb_mod_index_t ctrl; 110 xkb_mod_index_t ctrl;
110 xkb_mod_index_t alt; 111 xkb_mod_index_t alt;
111 xkb_mod_index_t altgr; 112 xkb_mod_index_t altgr;