From 0bfb13655c02c75b0e1cc864a81996e58cd5c7b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Mon, 14 Sep 2020 15:38:49 +0200 Subject: Implement de/focus event parsing So far there is no way to set it up, I'm not sure how to go about it. --- driver-csi.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'driver-csi.c') diff --git a/driver-csi.c b/driver-csi.c index 7f6b008..bb4b000 100644 --- a/driver-csi.c +++ b/driver-csi.c @@ -331,6 +331,33 @@ handle_csi_m (termo_t *tk, termo_key_t *key, int cmd, long *arg, int args) return TERMO_RES_NONE; } +// +// Handler for CSI I / CSI O focus events +// + +static termo_result_t +handle_csi_IO (termo_t *tk, termo_key_t *key, int cmd, long *arg, int args) +{ + (void) tk; + (void) arg; + (void) args; + + switch (cmd &= 0xff) + { + case 'I': + key->type = TERMO_TYPE_FOCUS; + key->code.focused = true; + return TERMO_RES_KEY; + case 'O': + key->type = TERMO_TYPE_FOCUS; + key->code.focused = false; + return TERMO_RES_KEY; + default: + return TERMO_RES_NONE; + } + return TERMO_RES_NONE; +} + termo_result_t termo_interpret_mouse (termo_t *tk, const termo_key_t *key, termo_mouse_event_t *event, int *button, int *line, int *col) @@ -671,6 +698,9 @@ register_keys (void) csi_handlers['M' - 0x20] = &handle_csi_m; csi_handlers['m' - 0x20] = &handle_csi_m; + csi_handlers['I' - 0x20] = &handle_csi_IO; + csi_handlers['O' - 0x20] = &handle_csi_IO; + csi_handlers['R' - 0x20] = &handle_csi_R; csi_handlers['y' - 0x20] = &handle_csi_y; -- cgit v1.2.3