aboutsummaryrefslogtreecommitdiff
path: root/termkey.h.in
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2009-11-27 14:36:29 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2009-11-27 14:36:29 +0000
commit24f97118465817c09c28103e7c94252b28fa06aa (patch)
treeb46a911ef72301f60a522d4d95be239e1ef9bc10 /termkey.h.in
parent6dc2b9c72bf121aed0f9011d925b2c551a22ada2 (diff)
downloadtermo-24f97118465817c09c28103e7c94252b28fa06aa.tar.gz
termo-24f97118465817c09c28103e7c94252b28fa06aa.tar.xz
termo-24f97118465817c09c28103e7c94252b28fa06aa.zip
Return opaque mouse events in the key structure; add a function to interpret this into its component fields
Diffstat (limited to 'termkey.h.in')
-rw-r--r--termkey.h.in16
1 files changed, 12 insertions, 4 deletions
diff --git a/termkey.h.in b/termkey.h.in
index ae11856..9ed82c5 100644
--- a/termkey.h.in
+++ b/termkey.h.in
@@ -100,6 +100,13 @@ typedef enum {
TERMKEY_RES_AGAIN,
} TermKeyResult;
+typedef enum {
+ TERMKEY_MOUSE_UNKNOWN,
+ TERMKEY_MOUSE_PRESS,
+ TERMKEY_MOUSE_DRAG,
+ TERMKEY_MOUSE_RELEASE,
+} TermKeyMouseEvent;
+
enum {
TERMKEY_KEYMOD_SHIFT = 1 << 0,
TERMKEY_KEYMOD_ALT = 1 << 1,
@@ -112,11 +119,10 @@ typedef struct {
long codepoint; // TERMKEY_TYPE_UNICODE
int number; // TERMKEY_TYPE_FUNCTION
TermKeySym sym; // TERMKEY_TYPE_KEYSYM
- struct {
- short buttons;
- short col, line;
- } mouse; // TERMKEY_TYPE_MOUSE
+ char mouse[4]; // TERMKEY_TYPE_MOUSE
+ // opaque. see termkey_interpret_mouse
} code;
+
int modifiers;
/* Any Unicode character can be UTF-8 encoded in no more than 6 bytes, plus
@@ -159,6 +165,8 @@ TermKeyResult termkey_advisereadable(TermKey *tk);
TermKeySym termkey_register_keyname(TermKey *tk, TermKeySym sym, const char *name);
const char *termkey_get_keyname(TermKey *tk, TermKeySym sym);
+TermKeyResult termkey_interpret_mouse(TermKey *tk, TermKeyKey *key, TermKeyMouseEvent *event, int *button, int *line, int *col);
+
TermKeySym termkey_keyname2sym(TermKey *tk, const char *keyname);
typedef enum {