aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillermo Ramos2011-09-20 22:32:56 +0200
committerGuillermo Ramos2011-09-20 22:32:56 +0200
commitd26cfab77984803f14bd198880670241f8cdffee (patch)
tree0a7ab3448b629f6eef714b6703679986c2700753
parentf680abf1814f61f1a9445fdc84f05d10036c513f (diff)
downloadevspy-d26cfab77984803f14bd198880670241f8cdffee.tar.gz
Fixed redundant code in AltGr handling
-rw-r--r--evspy-core.c8
-rw-r--r--evspy-core.h21
2 files changed, 15 insertions, 14 deletions
diff --git a/evspy-core.c b/evspy-core.c
index edcd4e5..ec41f1e 100644
--- a/evspy-core.c
+++ b/evspy-core.c
@@ -28,7 +28,10 @@ static char *rdp; // read pointer
static char *wrp; // write pointer
static unsigned short int capslock_on = 0;
static unsigned short int shift_on = 0;
+
+#ifdef EVS_ALTGR_ENABLED
static unsigned short int altgr_on = 0;
+#endif
/*
* Executed when the procfs file is read (EVS_PROCNAME)
@@ -193,9 +196,12 @@ static void evspy_event(struct input_handle *handle, unsigned int type,
// "Immediate" keys (alphanumeric + some symbols)
} else if (value == EVS_VAL_PRESS) {
+#ifdef EVS_ALTGR_ENABLED
if (altgr_on)
evs_insert(evs_altgr(code));
- else if (shift_on || capslock_on)
+ else
+#endif
+ if (shift_on || capslock_on)
evs_insert(evs_shift(code));
else
evs_insert(map[code]);
diff --git a/evspy-core.h b/evspy-core.h
index 49da4b5..6cbe913 100644
--- a/evspy-core.h
+++ b/evspy-core.h
@@ -142,18 +142,13 @@
* Returns the character associated with event code c when altgr is pressed
*/
#ifdef EVS_ALTGR_ENABLED
-# define evs_altgr(c) \
- ({ \
- void *__vp; \
- char __c; \
- __vp = khm_get(ahm, (c)); \
- if (__vp) __c = *(char *)__vp; \
- else __c = map[c]; \
- __c; \
- })
-#else
-# define evs_altgr(c) \
+#define evs_altgr(c) \
({ \
- (c); \
- })
+ void *__vp; \
+ char __c; \
+ __vp = khm_get(ahm, (c)); \
+ if (__vp) __c = *(char *)__vp; \
+ else __c = map[c]; \
+ __c; \
+})
#endif