diff options
Diffstat (limited to 'src/wayland/keyboard.c')
| -rw-r--r-- | src/wayland/keyboard.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/wayland/keyboard.c b/src/wayland/keyboard.c index 7283d58..6045962 100644 --- a/src/wayland/keyboard.c +++ b/src/wayland/keyboard.c @@ -346,13 +346,11 @@ static bool mod_index_active(const struct seat *s, xkb_mod_index_t mod) int seat_modifiers(const struct seat *s) { - if (!s || !s->xkb_state) return 0; - int mods = 0; - if (mod_index_active(s, s->mod_shift)) mods |= YASL_MOD_SHIFT; - if (mod_index_active(s, s->mod_alt)) mods |= YASL_MOD_ALT; - if (mod_index_active(s, s->mod_ctrl)) mods |= YASL_MOD_CTRL; - if (mod_index_active(s, s->mod_super)) mods |= YASL_MOD_SUPER; - return mods; + if (unlikely(!s || !s->xkb_state)) return 0; + return (mod_index_active(s, s->mod_shift) * YASL_MOD_SHIFT) | + (mod_index_active(s, s->mod_alt) * YASL_MOD_ALT) | + (mod_index_active(s, s->mod_ctrl) * YASL_MOD_CTRL) | + (mod_index_active(s, s->mod_super) * YASL_MOD_SUPER); } int yasl_display_modifiers(const struct yasl_display *c) |
