Optimizing the key lookup to the X11 function key. It is still possible to - st - simple terminal (HTM) git clone https://git.parazyd.org/st (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 2b6521f5d23da404a597d675d12d4c0cf89657de (DIR) parent 927d8fb45971ddf0eac115ad04161aba6bbd8bc7 (HTM) Author: Christoph Lohmann <20h@r-36.net> Date: Thu, 15 Nov 2012 20:19:35 +0100 Optimizing the key lookup to the X11 function key. It is still possible to remap other keys. Diffstat: M config.def.h | 6 ++++++ M st.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 0 deletions(-) --- (DIR) diff --git a/config.def.h b/config.def.h @@ -88,6 +88,12 @@ static Shortcut shortcuts[] = { * position for a key. */ +/* + * If you want something else but the function keys of X11 (0xFF00 - 0xFFFF) + * mapped below, add them to this array. + */ +static KeySym mappedkeys[] = { -1 }; + /* key, mask, output, keypad, cursor, crlf */ static Key key[] = { /* keysym mask string keypad cursor crlf */ (DIR) diff --git a/st.c b/st.c @@ -2711,6 +2711,20 @@ char* kmap(KeySym k, uint state) { uint mask; Key *kp; + int i; + + /* Check for mapped keys out of X11 function keys. */ + for(i = 0; i < LEN(mappedkeys); i++) { + if(mappedkeys[i] == k) { + fprintf(stderr, "mapped function key.\n"); + break; + } + } + if(i == LEN(mappedkeys)) { + if((k & 0xFFFF) < 0xFF00) + return NULL; + } + fprintf(stderr, "Function key.\n"); for(kp = key; kp < key + LEN(key); kp++) { mask = kp->mask;