aboutsummaryrefslogtreecommitdiff
path: root/evspy-core.h
diff options
context:
space:
mode:
authorGuillermo Ramos2011-09-20 21:52:34 +0200
committerGuillermo Ramos2011-09-20 22:01:30 +0200
commitf680abf1814f61f1a9445fdc84f05d10036c513f (patch)
tree13d1c3ddc46599f666ea9f40b28f5da2013a3fbb /evspy-core.h
parent161cc97a59078a606c41c2ec2a6371dc04d5aac8 (diff)
downloadevspy-f680abf1814f61f1a9445fdc84f05d10036c513f.tar.gz
Fixed shift/capslock bug
Diffstat (limited to 'evspy-core.h')
-rw-r--r--evspy-core.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/evspy-core.h b/evspy-core.h
index 5b7abec..49da4b5 100644
--- a/evspy-core.h
+++ b/evspy-core.h
@@ -49,7 +49,7 @@
#define EVS_VAL_PRESS 1
#define EVS_VAL_HOLD 2
-#define MIN(x, y) (x) < (y) ? (x) : (y)
+#define is_ascii(c) (map[c] >= 'a' && map[c] <= 'z')
/*
* If pointer is at the end of buffer, put it at the beginning.
@@ -124,13 +124,16 @@
#define evs_shift(c) \
({ \
void *__vp; \
- char __c = (c); \
- if (map[c] >= 'a' && map[c] <= 'z') { \
+ char __c; \
+ if ((shift_on != capslock_on) && is_ascii(c)) { \
__c = map[c] + ('A'-'a'); \
+ } else if (is_ascii(c) || !shift_on) { \
+ __c = map[c]; \
} else { \
- __vp = khm_get(shm, (c)); \
- if (__vp) __c = *(char *)__vp; \
- else __c = map[c]; \
+ if ((__vp = khm_get(shm, (c)))) \
+ __c = *(char *)__vp; \
+ else \
+ __c = map[c]; \
} \
__c; \
})