aboutsummaryrefslogtreecommitdiff
path: root/src/lib/libkogata
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2015-03-13 14:46:15 +0100
committerAlex Auvolat <alex@adnab.me>2015-03-13 14:59:44 +0100
commitd0dc9f38184956af49379d7e2585756523cfa4c1 (patch)
tree0c3014986187038b16141c2ef58dfb4799ec74ff /src/lib/libkogata
parent243e6d72928d1fc4cf20366eab9007980b945458 (diff)
downloadkogata-d0dc9f38184956af49379d7e2585756523cfa4c1.tar.gz
kogata-d0dc9f38184956af49379d7e2585756523cfa4c1.zip
Fix keyboard handling.
Diffstat (limited to 'src/lib/libkogata')
-rw-r--r--src/lib/libkogata/keyboard.c15
1 files changed, 10 insertions, 5 deletions
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 :*/