summaryrefslogtreecommitdiff
path: root/src/common/keyboard.h
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-12 22:12:02 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-12 22:12:02 +0300
commit94c5e361fbb229b0cd6853e2102a7d95f1f358b3 (patch)
tree3c0f11af9dcb84dac8067a31a6979acd6dd56fbf /src/common/keyboard.h
parent08dc9047098d6d96791024ac7d8f5837633673ef (diff)
better public interface and doxygen
Diffstat (limited to 'src/common/keyboard.h')
-rw-r--r--src/common/keyboard.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/keyboard.h b/src/common/keyboard.h
new file mode 100644
index 0000000..50ddbb3
--- /dev/null
+++ b/src/common/keyboard.h
@@ -0,0 +1,18 @@
+#ifndef YASL_COMMON_KEYBOARD_H
+#define YASL_COMMON_KEYBOARD_H
+
+#include "yasl/yasl.h"
+
+enum yasl_key yasl_key_from_evdev(uint32_t code);
+enum yasl_key yasl_key_from_xkb_name(const char name[4]);
+enum yasl_key yasl_key_from_cocoa(uint32_t code);
+
+/* Layout labels omit controls, invalid Unicode, and Cocoa function-key PUA. */
+static inline uint32_t yasl_key_label(uint32_t cp)
+{
+ return cp >= 0x20 && cp != 0x7f && cp <= 0x10ffff &&
+ !(cp >= 0x80 && cp <= 0x9f) && !(cp >= 0xd800 && cp <= 0xdfff) &&
+ !(cp >= 0xf700 && cp <= 0xf7ff) ? cp : 0;
+}
+
+#endif