aboutsummaryrefslogtreecommitdiff
path: root/driver-csi.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-09-14 15:38:49 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-09-14 17:55:41 +0200
commit0bfb13655c02c75b0e1cc864a81996e58cd5c7b4 (patch)
treebce0c60337beda47d632511f0f4e0afd9bb7eb17 /driver-csi.c
parent78c0cd443d7e302fac6448db9d776c02a185d084 (diff)
downloadtermo-0bfb13655c02c75b0e1cc864a81996e58cd5c7b4.tar.gz
termo-0bfb13655c02c75b0e1cc864a81996e58cd5c7b4.tar.xz
termo-0bfb13655c02c75b0e1cc864a81996e58cd5c7b4.zip
Implement de/focus event parsing
So far there is no way to set it up, I'm not sure how to go about it.
Diffstat (limited to 'driver-csi.c')
-rw-r--r--driver-csi.c30
1 files changed, 30 insertions, 0 deletions
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;