aboutsummaryrefslogtreecommitdiffstats
path: root/libterminput.h
diff options
context:
space:
mode:
Diffstat (limited to 'libterminput.h')
-rw-r--r--libterminput.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libterminput.h b/libterminput.h
index 45ac2a4..0182a54 100644
--- a/libterminput.h
+++ b/libterminput.h
@@ -183,6 +183,16 @@ struct libterminput_state {
*/
int libterminput_read(int fd, union libterminput_input *input, struct libterminput_state *ctx);
+inline int
+libterminput_is_ready(union libterminput_input *input, struct libterminput_state *ctx)
+{
+ if (!ctx->inited)
+ return 0;
+ if (input->type == LIBTERMINPUT_KEYPRESS && input->keypress.times > 1)
+ return 1;
+ return ctx->stored_head > ctx->stored_tail;
+}
+
int libterminput_set_flags(struct libterminput_state *ctx, enum libterminput_flags flags);
int libterminput_clear_flags(struct libterminput_state *ctx, enum libterminput_flags flags);