Xinqi Bao's Git
projects
/
st.git
/ diff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
927d8fb
)
Optimizing the key lookup to the X11 function key. It is still possible to
author
Christoph Lohmann <
[email protected]
>
Thu, 15 Nov 2012 19:19:35 +0000
(20:19 +0100)
committer
Christoph Lohmann <
[email protected]
>
Thu, 15 Nov 2012 19:19:35 +0000
(20:19 +0100)
remap other keys.
config.def.h
diff
|
blob
|
history
st.c
diff
|
blob
|
history
diff --git
a/config.def.h
b/config.def.h
index
7a7262c
..
c0519a8
100644
(file)
--- a/
config.def.h
+++ b/
config.def.h
@@
-88,6
+88,12
@@
static Shortcut shortcuts[] = {
* position for a key.
*/
* 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 */
/* key, mask, output, keypad, cursor, crlf */
static Key key[] = {
/* keysym mask string keypad cursor crlf */
diff --git
a/st.c
b/st.c
index
477a8f8
..
02ef411
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-2711,6
+2711,20
@@
char*
kmap(KeySym k, uint state) {
uint mask;
Key *kp;
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;
for(kp = key; kp < key + LEN(key); kp++) {
mask = kp->mask;