[hackers] [st] Optimizing the key lookup to the X11 function key. It is still possible to || Christoph Lohmann
 
changeset:   418:0ad3f4a8fa1d
tag:         tip
user:        Christoph Lohmann <20h_AT_r-36.net>
date:        Thu Nov 15 20:19:35 2012 +0100
files:       config.def.h st.c
description:
Optimizing the key lookup to the X11 function key. It is still possible to
remap other keys.
diff -r 794853c3b990 -r 0ad3f4a8fa1d config.def.h
--- a/config.def.h	Thu Nov 15 20:03:18 2012 +0100
+++ b/config.def.h	Thu Nov 15 20:19:35 2012 +0100
_AT_@ -88,6 +88,12 @@
  * 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 */
diff -r 794853c3b990 -r 0ad3f4a8fa1d st.c
--- a/st.c	Thu Nov 15 20:03:18 2012 +0100
+++ b/st.c	Thu Nov 15 20:19:35 2012 +0100
_AT_@ -2711,6 +2711,20 @@
 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;
Received on Thu Nov 15 2012 - 20:21:39 CET
This archive was generated by hypermail 2.3.0
: Thu Nov 15 2012 - 20:24:06 CET