Wayland: Clean up modifier key event handler

Adapt style and naming to match the rest of the project.
This commit is contained in:
Camilla Löwy 2021-12-31 00:19:58 +01:00
parent 0ce611958e
commit df8d7bc892

View File

@ -604,9 +604,6 @@ static void keyboardHandleModifiers(void* data,
uint32_t modsLocked, uint32_t modsLocked,
uint32_t group) uint32_t group)
{ {
xkb_mod_mask_t mask;
unsigned int modifiers = 0;
_glfw.wl.serial = serial; _glfw.wl.serial = serial;
if (!_glfw.wl.xkb.keymap) if (!_glfw.wl.xkb.keymap)
@ -620,24 +617,29 @@ static void keyboardHandleModifiers(void* data,
0, 0,
group); group);
mask = xkb_state_serialize_mods(_glfw.wl.xkb.state, const xkb_mod_mask_t mask =
xkb_state_serialize_mods(_glfw.wl.xkb.state,
XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_DEPRESSED |
XKB_STATE_LAYOUT_DEPRESSED | XKB_STATE_LAYOUT_DEPRESSED |
XKB_STATE_MODS_LATCHED | XKB_STATE_MODS_LATCHED |
XKB_STATE_LAYOUT_LATCHED); XKB_STATE_LAYOUT_LATCHED);
unsigned int mods = 0;
if (mask & _glfw.wl.xkb.controlMask) if (mask & _glfw.wl.xkb.controlMask)
modifiers |= GLFW_MOD_CONTROL; mods |= GLFW_MOD_CONTROL;
if (mask & _glfw.wl.xkb.altMask) if (mask & _glfw.wl.xkb.altMask)
modifiers |= GLFW_MOD_ALT; mods |= GLFW_MOD_ALT;
if (mask & _glfw.wl.xkb.shiftMask) if (mask & _glfw.wl.xkb.shiftMask)
modifiers |= GLFW_MOD_SHIFT; mods |= GLFW_MOD_SHIFT;
if (mask & _glfw.wl.xkb.superMask) if (mask & _glfw.wl.xkb.superMask)
modifiers |= GLFW_MOD_SUPER; mods |= GLFW_MOD_SUPER;
if (mask & _glfw.wl.xkb.capsLockMask) if (mask & _glfw.wl.xkb.capsLockMask)
modifiers |= GLFW_MOD_CAPS_LOCK; mods |= GLFW_MOD_CAPS_LOCK;
if (mask & _glfw.wl.xkb.numLockMask) if (mask & _glfw.wl.xkb.numLockMask)
modifiers |= GLFW_MOD_NUM_LOCK; mods |= GLFW_MOD_NUM_LOCK;
_glfw.wl.xkb.modifiers = modifiers;
_glfw.wl.xkb.modifiers = mods;
} }
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION #ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION