Commit 0a15e1ab authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz
Browse files

virtual_keyboard: give names to modifier keys

Fixes the bad generation of CTRL modifier.
parent 401417c7
......@@ -91,6 +91,16 @@ struct virtual_keyboard {
uint32_t buttons_held;
};
/// Modifiers passed to the virtual_keyboard protocol.
/// They are based on wayland's wl_keyboard, which doesn't document them.
enum key_modifier_type {
modifier_none = 0,
modifier_shift = 1,
modifier_capslock = 2,
modifier_ctrl = 4,
modifier_altgr = 128,
};
enum key_type {
keytype_default,
keytype_backspace,
......@@ -640,16 +650,16 @@ append(char *s1, const char *s2)
}
static void keyboard_update_mods(struct keyboard *keyboard) {
unsigned mods = keyboard->ctrl_on << 2;
unsigned mods = keyboard->ctrl_on ? modifier_ctrl : modifier_none;
unsigned locked = 0;
switch(keyboard->state) {
case KEYBOARD_STATE_DEFAULT:
break;
case KEYBOARD_STATE_UPPERCASE:
locked |= 2;
locked |= modifier_capslock;
break;
case KEYBOARD_STATE_SYMBOLS:
mods |= 128;
mods |= modifier_altgr;
break;
default:
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment