diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-11 23:27:41 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-11 23:27:41 +0300 |
| commit | 472ed3e4e50a165638acecaf071ec3c2c13c451f (patch) | |
| tree | d1894debde800d8e87d3c242ae6c3f4760c68787 /src/wayland/keyboard.c | |
| parent | 8d9f7c7cb39359d62bf28ef1775b944a7dddd6fb (diff) | |
core: optimize struct layouts, eliminate branches, and fix event loop dispatch
- Fix Wayland event loop lockout by properly decoupling read arming and adding poll-backed dispatching
- Support standalone display lifecycle without requiring caller to manage a loop
- Eliminate alignment holes across yasl_surface, yasl_display, seat, touch_point, and conn_drag using pahole
- Replace branching state/button decoders with compile-time locked LUTs and branchless bitwise operations
- Accelerate UTF-8 validation with 64-bit word scanning for ASCII runs
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) |
