From 3acf497ecf360459f314f8db3bda6ae564dcca0c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 21 Dec 2025 20:15:54 +0100 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- common.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 common.h (limited to 'common.h') 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 +#include +#include + +#include +#include +#include +#include + + +#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 -- cgit v1.3.1