summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornrootconauto <nrootconauto@gmail.com>2022-07-02 18:56:27 -0400
committernrootconauto <nrootconauto@gmail.com>2022-07-02 18:56:27 -0400
commit1d531ce3f54aada2e2b8212cf432ba37d4c4819e (patch)
treeea2f134498bfbf113f375a784ec8b19f3f066657
parentef95e8b7b44168e20ec93b092813aca6301a4ef3 (diff)
Removed repeat keydowns on X11.
Signed-off-by: nrootconauto <nrootconauto@gmail.com>
-rw-r--r--window.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/window.c b/window.c
index 49aa6ed..d2c67ed 100644
--- a/window.c
+++ b/window.c
@@ -237,11 +237,15 @@ static int32_t __ScanKey(int64_t *ch,int64_t *sc,XEvent *_e) {
} else \
mod|=(persist_mod|=(flag));
int64_t mod=persist_mod,cond,dummy;
+ static int64_t prev_key_press=-1;
if(!ch) ch=&dummy;
if(!sc) sc=&dummy;
cond=1;
if(cond) {
if(e.type==KeyPress) {
+ if(prev_key_press==XLookupKeysym(&e,0))
+ return -1;
+ prev_key_press=XLookupKeysym(&e,0);
ent:
*ch=*sc=0;
if(e.xkey.state&ShiftMask)
@@ -437,6 +441,7 @@ static int32_t __ScanKey(int64_t *ch,int64_t *sc,XEvent *_e) {
return 1;
}
} else if(e.type==KeyRelease) {
+ prev_key_press=0;
mod|=SCF_KEY_UP;
goto ent;
}