wl: modmask's caller has already looked at the keymap

grabkey returns before it asks for the mask when there is no keyboard
state, so the guard inside modmask answered a question nobody put to it --
except the test, which was the only caller that could reach it.  A check
kept alive by the test that reaches it is one line of code and one line of
test to delete.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-17 21:22:36 +09:00
parent 33710178d4
commit 8472474332
2 changed files with 0 additions and 4 deletions

View File

@@ -40,8 +40,6 @@ wl_modifier_mask(struct ct *t)
struct xkb_keymap *km; struct xkb_keymap *km;
xkb_mod_mask_t caps, ctrl, shift; xkb_mod_mask_t caps, ctrl, shift;
kstate = nil;
CT_EQ_UINT(t, 0, modmask()); /* before any keymap arrives */
ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS); ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
km = xkb_keymap_new_from_string(ctx, keymaptext, km = xkb_keymap_new_from_string(ctx, keymaptext,
XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS);

2
wl.c
View File

@@ -126,8 +126,6 @@ modmask(void)
int i; int i;
m = 0; m = 0;
if(kstate == nil)
return m;
for(i = 0; i < nelem(name); i++) for(i = 0; i < nelem(name); i++)
if(xkb_state_mod_name_is_active(kstate, name[i], if(xkb_state_mod_name_is_active(kstate, name[i],
XKB_STATE_MODS_EFFECTIVE) > 0) XKB_STATE_MODS_EFFECTIVE) > 0)