#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