From 2ba9849ab536645f621e311f7afa48e5199055d1 Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Tue, 24 Nov 2009 01:22:55 +0000 Subject: Public interface for MOUSE support --- termkey.c | 4 ++++ termkey.h.in | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/termkey.c b/termkey.c index 7a90684..147b82d 100644 --- a/termkey.c +++ b/termkey.c @@ -920,6 +920,10 @@ size_t termkey_snprint_key(TermKey *tk, char *buffer, size_t len, TermKeyKey *ke case TERMKEY_TYPE_FUNCTION: l = snprintf(buffer + pos, len - pos, "F%d", key->code.number); break; + case TERMKEY_TYPE_MOUSE: + l = snprintf(buffer + pos, len - pos, "MOUSE(0x%02x,%d,%d)", + key->code.mouse.buttons, key->code.mouse.line, key->code.mouse.col); + break; } if(l <= 0) return pos; diff --git a/termkey.h.in b/termkey.h.in index eebfeff..ae11856 100644 --- a/termkey.h.in +++ b/termkey.h.in @@ -89,7 +89,8 @@ typedef enum { typedef enum { TERMKEY_TYPE_UNICODE, TERMKEY_TYPE_FUNCTION, - TERMKEY_TYPE_KEYSYM + TERMKEY_TYPE_KEYSYM, + TERMKEY_TYPE_MOUSE, } TermKeyType; typedef enum { @@ -111,6 +112,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 } code; int modifiers; -- cgit v1.2.3-70-g09d2