mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 13:40:21 +00:00
Keycontrol: function to obtain key name
This commit is contained in:
@@ -882,3 +882,9 @@ bool keycontrol_register_key(struct module *receiver_mod, int64_t key, const cha
|
||||
return true;
|
||||
}
|
||||
|
||||
void get_keycode_name(int64_t ch, char *buf, size_t buflen) {
|
||||
string name = get_keycode_representation(ch);
|
||||
strncpy(buf, name.c_str(), buflen - 1);
|
||||
buf[buflen - 1] = '\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -110,10 +110,13 @@ private:
|
||||
#define K_LEFT 0x1b5b44
|
||||
#define K_CTRL(x) (1 + tolower(x) - 'a')
|
||||
|
||||
#define MAX_KEYCODE_NAME_LEN 64
|
||||
|
||||
// attribute used guaranties that the symbol is present even if not referenced (modular build)
|
||||
/// @todo all UG core functions should have the 'used' attribute
|
||||
EXTERN_C void keycontrol_send_key(struct module *root, int64_t key) ATTRIBUTE(used);
|
||||
EXTERN_C bool keycontrol_register_key(struct module *sender_mod, int64_t key, const char *message, const char *description) ATTRIBUTE(used);
|
||||
EXTERN_C void get_keycode_name(int64_t ch, char *buf, size_t buflen) ATTRIBUTE(used);
|
||||
|
||||
#endif // keyboard_control_h_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user