From d0dc9f38184956af49379d7e2585756523cfa4c1 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 13 Mar 2015 14:46:15 +0100 Subject: Fix keyboard handling. --- src/lib/libkogata/keyboard.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/lib/libkogata/keyboard.c') diff --git a/src/lib/libkogata/keyboard.c b/src/lib/libkogata/keyboard.c index 7e3c376..505c048 100644 --- a/src/lib/libkogata/keyboard.c +++ b/src/lib/libkogata/keyboard.c @@ -85,7 +85,7 @@ int key_chr(keyboard_t *kb, int k) { return kb->km.mod[k]; } } else if ((kb->status & KBD_CAPS) && (kb->status & KBD_SHIFT)) { - return kb->km.normal[k]; + return kb->km.shiftcaps[k]; } else if (kb->status & KBD_SHIFT) { return kb->km.shift[k]; } else if (kb->status & KBD_CAPS) { @@ -95,7 +95,7 @@ int key_chr(keyboard_t *kb, int k) { } } -key_t make_key(keyboard_t *kb, int k) { +key_t make_key(keyboard_t *kb, int k, bool down) { key_t x; x.flags = kb->status; @@ -106,7 +106,12 @@ key_t make_key(keyboard_t *kb, int k) { if (x.key != 0) return x; x.flags |= KBD_CHAR; - x.chr = key_chr(kb, k); + if (down) { + x.chr = key_chr(kb, k); + kb->key_char[k] = x.chr; + } else { + x.chr = kb->key_char[k]; + } return x; } @@ -126,7 +131,7 @@ key_t keyboard_press(keyboard_t *kb, int k) { kb->status ^= KBD_CAPS; } - return make_key(kb, k); + return make_key(kb, k, true); } key_t keyboard_release(keyboard_t *kb, int k) { @@ -142,7 +147,7 @@ key_t keyboard_release(keyboard_t *kb, int k) { kb->status &= ~KBD_MOD; } - return make_key(kb, k); + return make_key(kb, k, false); } /* vim: set ts=4 sw=4 tw=0 noet :*/ -- cgit v1.2.3