aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-02-19 23:06:02 +0100
committerMattias Andrée <m@maandree.se>2025-02-19 23:06:02 +0100
commit24ebd3c309c5d6cad63bbf1b40de8c17aead0366 (patch)
tree7deab3ddadf241ccfaefc31e65916b6036689285 /common.h
parentAdd tests for new escape sequences (diff)
downloadlibterminput-24ebd3c309c5d6cad63bbf1b40de8c17aead0366.tar.gz
libterminput-24ebd3c309c5d6cad63bbf1b40de8c17aead0366.tar.bz2
libterminput-24ebd3c309c5d6cad63bbf1b40de8c17aead0366.tar.xz
Add state marshalling and unmarshalling functions
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'common.h')
-rw-r--r--common.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/common.h b/common.h
index ba96f50..a1c385f 100644
--- a/common.h
+++ b/common.h
@@ -17,6 +17,19 @@
/**
+ * Mark that there is no input available or pending
+ *
+ * @param INPUT_OUT:union libterminput_input *input The input output
+ */
+#define NOTHING(INPUT_OUT)\
+ do {\
+ union libterminput_input *input__ = (INPUT_OUT);\
+ input__->type = LIBTERMINPUT_NONE;\
+ input__->keypress.key = LIBTERMINPUT_SYMBOL;\
+ } while (0);
+
+
+/**
* Singlar read symbol
*/
struct input {
@@ -130,5 +143,15 @@ HIDDEN void libterminput_parse_sequence__(union libterminput_input *input, struc
*/
HIDDEN int libterminput_read_symbol__(int fd, struct input *input, struct libterminput_state *ctx);
+/* TODO doc, test */
+HIDDEN int libterminput_marshal_keypress__(struct libterminput_marshaller *how, const struct libterminput_keypress *what);
+HIDDEN int libterminput_marshal_text__(struct libterminput_marshaller *how, const struct libterminput_text *what);
+HIDDEN int libterminput_marshal_mouseevent__(struct libterminput_marshaller *how, const struct libterminput_mouseevent *what);
+HIDDEN int libterminput_marshal_position__(struct libterminput_marshaller *how, const struct libterminput_position *what);
+HIDDEN int libterminput_unmarshal_keypress__(struct libterminput_unmarshaller *how, struct libterminput_keypress *what);
+HIDDEN int libterminput_unmarshal_text__(struct libterminput_unmarshaller *how, struct libterminput_text *what);
+HIDDEN int libterminput_unmarshal_mouseevent__(struct libterminput_unmarshaller *how, struct libterminput_mouseevent *what);
+HIDDEN int libterminput_unmarshal_position__(struct libterminput_unmarshaller *how, struct libterminput_position *what);
+
#undef HIDDEN