summaryrefslogtreecommitdiff
path: root/platform/linuxbsd/x11/key_mapping_x11.h
diff options
context:
space:
mode:
authorRiteo <riteo@posteo.net>2023-01-25 19:27:31 +0100
committerRiteo <riteo@posteo.net>2023-01-26 03:19:36 +0100
commitaa7cd714989d460f0709d1a1f8bebe918e9dae92 (patch)
treeeaefcb7eeba827c59d9252066df4cec7be16c1b8 /platform/linuxbsd/x11/key_mapping_x11.h
parente93266b9ff359c98e9f8e2a550e16ad77490fc4d (diff)
Put KeyMappingX11 stuff inside its own scope
This avoids collisions with other "concurrent" key mappers.
Diffstat (limited to 'platform/linuxbsd/x11/key_mapping_x11.h')
-rw-r--r--platform/linuxbsd/x11/key_mapping_x11.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/platform/linuxbsd/x11/key_mapping_x11.h b/platform/linuxbsd/x11/key_mapping_x11.h
index d4278a563c..48beefff4c 100644
--- a/platform/linuxbsd/x11/key_mapping_x11.h
+++ b/platform/linuxbsd/x11/key_mapping_x11.h
@@ -39,8 +39,21 @@
#include <X11/keysymdef.h>
#include "core/os/keyboard.h"
+#include "core/templates/hash_map.h"
class KeyMappingX11 {
+ struct HashMapHasherKeys {
+ static _FORCE_INLINE_ uint32_t hash(const Key p_key) { return hash_fmix32(static_cast<uint32_t>(p_key)); }
+ static _FORCE_INLINE_ uint32_t hash(const char32_t p_uchar) { return hash_fmix32(p_uchar); }
+ static _FORCE_INLINE_ uint32_t hash(const unsigned p_key) { return hash_fmix32(p_key); }
+ static _FORCE_INLINE_ uint32_t hash(const KeySym p_key) { return hash_fmix32(p_key); }
+ };
+
+ static inline HashMap<KeySym, Key, HashMapHasherKeys> xkeysym_map;
+ static inline HashMap<unsigned int, Key, HashMapHasherKeys> scancode_map;
+ static inline HashMap<Key, unsigned int, HashMapHasherKeys> scancode_map_inv;
+ static inline HashMap<KeySym, char32_t, HashMapHasherKeys> xkeysym_unicode_map;
+
KeyMappingX11() {}
public: