diff options
| author | Mattias Andrée <m@maandree.se> | 2025-12-21 20:15:54 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2025-12-21 20:15:54 +0100 |
| commit | 3acf497ecf360459f314f8db3bda6ae564dcca0c (patch) | |
| tree | 576547c1249ff73dd283316e062110d31fa22667 /common.h | |
| download | cmap-3acf497ecf360459f314f8db3bda6ae564dcca0c.tar.gz cmap-3acf497ecf360459f314f8db3bda6ae564dcca0c.tar.bz2 cmap-3acf497ecf360459f314f8db3bda6ae564dcca0c.tar.xz | |
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'common.h')
| -rw-r--r-- | common.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/common.h b/common.h new file mode 100644 index 0000000..7174f38 --- /dev/null +++ b/common.h @@ -0,0 +1,28 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef COMMON_H_ +#define COMMON_H_ + +#include <sys/epoll.h> +#include <locale.h> +#include <termios.h> + +#include <libsimple.h> +#include <libsimple-arg.h> +#include <libterminput.h> +#include <libcmap.h> + + +#define COMMA , + + +#define IS_KEY(INPUT, KEY)\ + ((INPUT)->keypress.key == LIBTERMINPUT_SYMBOL &&\ + toupper((INPUT)->keypress.symbol[0]) == toupper((KEY)) &&\ + !(INPUT)->keypress.symbol[1]) + +#define IS_CTRL_KEY(INPUT, KEY)\ + (((INPUT)->keypress.mods & (enum libterminput_mod)~LIBTERMINPUT_SHIFT) == LIBTERMINPUT_CTRL &&\ + IS_KEY((INPUT), (KEY))) + + +#endif |
