Wayland: Cleanup

master
Camilla Löwy ago%!(EXTRA string=3 years)
parent d3ede7b684
commit 523fdf50c1
  1. 50
      src/wl_window.c

@ -1428,51 +1428,31 @@ static void keyboardHandleModifiers(void* userData,
0, 0,
group); group);
unsigned int mods = 0; _glfw.wl.xkb.modifiers = 0;
if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, struct
_glfw.wl.xkb.controlIndex,
XKB_STATE_MODS_EFFECTIVE) == 1)
{ {
mods |= GLFW_MOD_CONTROL; xkb_mod_index_t index;
} unsigned int bit;
} modifiers[] =
if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state,
_glfw.wl.xkb.altIndex,
XKB_STATE_MODS_EFFECTIVE) == 1)
{
mods |= GLFW_MOD_ALT;
}
if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state,
_glfw.wl.xkb.shiftIndex,
XKB_STATE_MODS_EFFECTIVE) == 1)
{ {
mods |= GLFW_MOD_SHIFT; { _glfw.wl.xkb.controlIndex, GLFW_MOD_CONTROL },
} { _glfw.wl.xkb.altIndex, GLFW_MOD_ALT },
{ _glfw.wl.xkb.shiftIndex, GLFW_MOD_SHIFT },
{ _glfw.wl.xkb.superIndex, GLFW_MOD_SUPER },
{ _glfw.wl.xkb.capsLockIndex, GLFW_MOD_CAPS_LOCK },
{ _glfw.wl.xkb.numLockIndex, GLFW_MOD_NUM_LOCK }
};
if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, for (size_t i = 0; i < sizeof(modifiers) / sizeof(modifiers[0]); i++)
_glfw.wl.xkb.superIndex,
XKB_STATE_MODS_EFFECTIVE) == 1)
{ {
mods |= GLFW_MOD_SUPER;
}
if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state,
_glfw.wl.xkb.capsLockIndex, modifiers[i].index,
XKB_STATE_MODS_EFFECTIVE) == 1) XKB_STATE_MODS_EFFECTIVE) == 1)
{ {
mods |= GLFW_MOD_CAPS_LOCK; _glfw.wl.xkb.modifiers |= modifiers[i].bit;
} }
if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state,
_glfw.wl.xkb.numLockIndex,
XKB_STATE_MODS_EFFECTIVE) == 1)
{
mods |= GLFW_MOD_NUM_LOCK;
} }
_glfw.wl.xkb.modifiers = mods;
} }
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION #ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION

Loading…
Cancel
Save