[hackers] [svkbd] Fixing the problem of repeating keys. || Christoph Lohmann
changeset: 56:15fb11d6a0f2
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Fri Oct 26 23:53:29 2012 +0200
files: svkbd.c
description:
Fixing the problem of repeating keys.
diff -r 6d3fd3c4214b -r 15fb11d6a0f2 svkbd.c
--- a/svkbd.c Thu Nov 10 19:15:05 2011 +0100
+++ b/svkbd.c Fri Oct 26 23:53:29 2012 +0200
_AT_@ -63,7 +63,6 @@
static void cleanup(void);
static void configurenotify(XEvent *e);
static void countrows();
-static void unmapnotify(XEvent *e);
static void die(const char *errstr, ...);
static void drawkeyboard(void);
static void drawkey(Key *k);
_AT_@ -85,7 +84,6 @@
[ButtonPress] = buttonpress,
[ButtonRelease] = buttonrelease,
[ConfigureNotify] = configurenotify,
- [UnmapNotify] = unmapnotify,
[Expose] = expose,
[LeaveNotify] = leavenotify,
[MotionNotify] = motionnotify
_AT_@ -128,7 +126,8 @@
}
if(!IsModifierKey(keys[i].keysym) && keys[i].pressed == True) {
- keys[i].pressed = False;
+ unpress(&keys[i], 0);
+
drawkey(&keys[i]);
}
if(keys[i].highlighted == True) {
_AT_@ -172,8 +171,13 @@
break;
}
}
- if((k = findkey(ev->x, ev->y)))
- unpress(k, mod);
+
+ if(ev->x < 0 || ev->y < 0) {
+ unpress(NULL, mod);
+ } else {
+ if((k = findkey(ev->x, ev->y)))
+ unpress(k, mod);
+ }
}
void
_AT_@ -275,11 +279,6 @@
}
void
-unmapnotify(XEvent *e) {
- running = False;
-}
-
-void
expose(XEvent *e) {
XExposeEvent *ev = &e->xexpose;
_AT_@ -399,14 +398,15 @@
break;
}
}
- if(i != LENGTH(keys)) {
+ if(i != LENGTH(keys)) {
+ if(pressedmod) {
+ XTestFakeKeyEvent(dpy,
+ XKeysymToKeycode(dpy, pressedmod),
+ False, 0);
+ }
+ pressedmod = 0;
+
for(i = 0; i < LENGTH(keys); i++) {
- if(pressedmod) {
- XTestFakeKeyEvent(dpy,
- XKeysymToKeycode(dpy, pressedmod),
- False, 0);
- }
- pressedmod = 0;
if(keys[i].pressed) {
XTestFakeKeyEvent(dpy,
XKeysymToKeycode(dpy,
Received on Fri Oct 26 2012 - 23:56:38 CEST
This archive was generated by hypermail 2.3.0
: Sat Oct 27 2012 - 00:00:18 CEST