[client] overlay: show layout-translated hotkey labels
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled

Related to #1298
This commit is contained in:
Geoffrey McRae
2026-07-30 10:30:47 +10:00
parent e754f5841e
commit a9b8f437d4
7 changed files with 66 additions and 4 deletions

View File

@@ -225,6 +225,20 @@ done:
close(fd);
}
bool waylandGetKeyLabel(int key, char * label, size_t size)
{
if (!wlWm.xkbState)
return false;
key += 8; // xkb scancode is evdev scancode + 8
xkb_keysym_t sym = xkb_state_key_get_one_sym(wlWm.xkbState, key);
sym = xkb_keysym_to_upper(sym);
const uint32_t codepoint = xkb_keysym_to_utf32(sym);
return codepoint > 0x20 && codepoint != 0x7F &&
xkb_keysym_to_utf8(sym, label, size) > 0;
}
static void keyboardEnterHandler(void * data, struct wl_keyboard * keyboard,
uint32_t serial, struct wl_surface * surface, struct wl_array * keys)
{