diff options
author | pommicket <pommicket@gmail.com> | 2022-08-19 17:30:54 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-08-19 17:30:54 -0400 |
commit | b37150e7ae111808be79714eba52dad34b975689 (patch) | |
tree | 9501f5cbfaa1535e35bd71f1a7d4f72c0121dba6 /ted.c | |
parent | 81e1801ef0d61fe4e29db8b352b1fadff75503fb (diff) |
X1/X2 commands
Diffstat (limited to 'ted.c')
-rw-r--r-- | ted.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -392,3 +392,16 @@ void ted_load_configs(Ted *ted, bool reloading) { ted_load_fonts(ted); } } + +void ted_press_key(Ted *ted, SDL_Scancode scancode, SDL_Keymod modifier) { + u32 key_combo = (u32)scancode << 3 | + (u32)((modifier & (KMOD_LCTRL|KMOD_RCTRL)) != 0) << KEY_MODIFIER_CTRL_BIT | + (u32)((modifier & (KMOD_LSHIFT|KMOD_RSHIFT)) != 0) << KEY_MODIFIER_SHIFT_BIT | + (u32)((modifier & (KMOD_LALT|KMOD_RALT)) != 0) << KEY_MODIFIER_ALT_BIT; + if (key_combo < KEY_COMBO_COUNT) { + KeyAction *action = &ted_active_settings(ted)->key_actions[key_combo]; + if (action->command) { + command_execute(ted, action->command, action->argument); + } + } +} |