diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-28 07:43:37 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-28 07:43:37 +0300 |
commit | ca9e1f6391e9f944b524529d6d4eeec13be75c26 (patch) | |
tree | 7ddca8ae9a3678f5090beb774a8a46ef0788c499 | |
parent | dd95deadf3a4dca19288a0079938cd5b33bfa39d (diff) |
Cleanup: replace magic number with define for scan-code/key-code offset
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index 2ee9420dbf7..96340fc9090 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -107,6 +107,12 @@ static bool use_gnome_confine_hack = false; /** \name Private Types & Defines * \{ */ +/** + * From XKB internals, use for converting a scan-code from WAYLAND to a #xkb_keycode_t. + * Ideally this wouldn't need a local define. + */ +#define EVDEV_OFFSET 8 + struct buffer_t { void *data = nullptr; size_t size = 0; @@ -1939,7 +1945,7 @@ static void keyboard_handle_key(void *data, const uint32_t state) { input_t *input = static_cast<input_t *>(data); - const xkb_keycode_t key_code = key + 8; + const xkb_keycode_t key_code = key + EVDEV_OFFSET; const xkb_keysym_t sym = xkb_state_key_get_one_sym_without_modifiers( input->xkb_state_empty, input->xkb_state_empty_with_numlock, key_code); |