diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-11-03 21:23:59 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-11-03 21:23:59 +0000 |
commit | 6adbb40f6eb112b4a34b7696301421ec7aa212bb (patch) | |
tree | 1c7e3998c6344297c8116838ecccc7e12388ac31 | |
parent | c0f839c40d8b0dabcb131d19547f8347a6802b92 (diff) | |
download | termo-6adbb40f6eb112b4a34b7696301421ec7aa212bb.tar.gz termo-6adbb40f6eb112b4a34b7696301421ec7aa212bb.tar.xz termo-6adbb40f6eb112b4a34b7696301421ec7aa212bb.zip |
Neater bitfield constants in .h file; added docs of TERMKEY_FORMAT_* constants
-rw-r--r-- | termkey.h | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -94,9 +94,9 @@ typedef enum { } termkey_result; enum { - TERMKEY_KEYMOD_SHIFT = 0x01, - TERMKEY_KEYMOD_ALT = 0x02, - TERMKEY_KEYMOD_CTRL = 0x04, + TERMKEY_KEYMOD_SHIFT = 1 << 0, + TERMKEY_KEYMOD_ALT = 1 << 1, + TERMKEY_KEYMOD_CTRL = 1 << 2, }; typedef int termkey_keysym; @@ -118,11 +118,11 @@ typedef struct { typedef struct termkey termkey_t; enum { - TERMKEY_FLAG_NOINTERPRET = 0x01, // Do not interpret C0//G1 codes if possible - TERMKEY_FLAG_CONVERTKP = 0x02, // Convert KP codes to regular keypresses - TERMKEY_FLAG_RAW = 0x04, // Input is raw bytes, not UTF-8 - TERMKEY_FLAG_UTF8 = 0x08, // Input is definitely UTF-8 - TERMKEY_FLAG_NOTERMIOS = 0x10, // Do not make initial termios calls on construction + TERMKEY_FLAG_NOINTERPRET = 1 << 0, // Do not interpret C0//G1 codes if possible + TERMKEY_FLAG_CONVERTKP = 1 << 1, // Convert KP codes to regular keypresses + TERMKEY_FLAG_RAW = 1 << 2, // Input is raw bytes, not UTF-8 + TERMKEY_FLAG_UTF8 = 1 << 3, // Input is definitely UTF-8 + TERMKEY_FLAG_NOTERMIOS = 1 << 4, // Do not make initial termios calls on construction }; termkey_t *termkey_new(int fd, int flags); @@ -144,10 +144,10 @@ termkey_keysym termkey_register_keyname(termkey_t *tk, termkey_keysym sym, const const char *termkey_get_keyname(termkey_t *tk, termkey_keysym sym); typedef enum { - TERMKEY_FORMAT_LONGMOD = 1, - TERMKEY_FORMAT_CARETCTRL = 2, - TERMKEY_FORMAT_ALTISMETA = 4, - TERMKEY_FORMAT_WRAPBRACKET = 8, + TERMKEY_FORMAT_LONGMOD = 1 << 0, // Shift-... instead of S-... + TERMKEY_FORMAT_CARETCTRL = 1 << 1, // ^X instead of C-X + TERMKEY_FORMAT_ALTISMETA = 1 << 2, // Meta- or M- instead of Alt- or A- + TERMKEY_FORMAT_WRAPBRACKET = 1 << 3, // Wrap special keys in brackets like <Escape> } termkey_format; // Some useful combinations |