Public interface for MOUSE support

This commit is contained in:
Paul LeoNerd Evans 2009-11-24 01:22:55 +00:00
parent 513e0ac59b
commit 2ba9849ab5
2 changed files with 10 additions and 1 deletions

View File

@ -920,6 +920,10 @@ size_t termkey_snprint_key(TermKey *tk, char *buffer, size_t len, TermKeyKey *ke
case TERMKEY_TYPE_FUNCTION: case TERMKEY_TYPE_FUNCTION:
l = snprintf(buffer + pos, len - pos, "F%d", key->code.number); l = snprintf(buffer + pos, len - pos, "F%d", key->code.number);
break; 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; if(l <= 0) return pos;

View File

@ -89,7 +89,8 @@ typedef enum {
typedef enum { typedef enum {
TERMKEY_TYPE_UNICODE, TERMKEY_TYPE_UNICODE,
TERMKEY_TYPE_FUNCTION, TERMKEY_TYPE_FUNCTION,
TERMKEY_TYPE_KEYSYM TERMKEY_TYPE_KEYSYM,
TERMKEY_TYPE_MOUSE,
} TermKeyType; } TermKeyType;
typedef enum { typedef enum {
@ -111,6 +112,10 @@ typedef struct {
long codepoint; // TERMKEY_TYPE_UNICODE long codepoint; // TERMKEY_TYPE_UNICODE
int number; // TERMKEY_TYPE_FUNCTION int number; // TERMKEY_TYPE_FUNCTION
TermKeySym sym; // TERMKEY_TYPE_KEYSYM TermKeySym sym; // TERMKEY_TYPE_KEYSYM
struct {
short buttons;
short col, line;
} mouse; // TERMKEY_TYPE_MOUSE
} code; } code;
int modifiers; int modifiers;