[Bf-blender-cvs] [d904d64de6a] cycles_oneapi: Cleanup: replace magic number with define for scan-code/key-code offset

Campbell Barton noreply at git.blender.org
Wed Jun 29 10:38:39 CEST 2022


Commit: d904d64de6a7975ef317d91d043a935fe4d784e7
Author: Campbell Barton
Date:   Tue Jun 28 14:43:37 2022 +1000
Branches: cycles_oneapi
https://developer.blender.org/rBd904d64de6a7975ef317d91d043a935fe4d784e7

Cleanup: replace magic number with define for scan-code/key-code offset

===================================================================

M	intern/ghost/intern/GHOST_SystemWayland.cpp

===================================================================

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);



More information about the Bf-blender-cvs mailing list