~petersanchez/st

2b6521f5d23da404a597d675d12d4c0cf89657de — Christoph Lohmann 11 years ago 927d8fb
Optimizing the key lookup to the X11 function key. It is still possible to

remap other keys.
2 files changed, 20 insertions(+), 0 deletions(-)

M config.def.h
M st.c
M config.def.h => config.def.h +6 -0
@@ 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 */

M st.c => st.c +14 -0
@@ 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;