From 9e7cb40b1f527c1bf431d4ca6c9b9ca4e70b5459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 9 Jul 2015 14:54:23 +0200 Subject: ui: move input handling code to ui specific files --- ui.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'ui.h') diff --git a/ui.h b/ui.h index 732c618..40e2ea7 100644 --- a/ui.h +++ b/ui.h @@ -15,6 +15,11 @@ enum UiOption { UI_OPTION_LINE_NUMBERS_RELATIVE = 1 << 1, }; +typedef struct { + char str[6]; /* UTF8 character or terminal escape code */ + int code; /* curses KEY_* constant */ +} Key; + #include #include #include "text.h" @@ -40,10 +45,8 @@ struct Ui { void (*update)(Ui*); void (*suspend)(Ui*); void (*resume)(Ui*); -/* TODO main loop integration, signal handling - Key getkey(void); - bool haskey(void); -*/ + Key (*getkey)(Ui*); + bool (*haskey)(Ui*); }; struct UiWin { -- cgit v1.2.3