Disregard obsolete events, fixed issue #64
This commit is contained in:
parent
c78f55ebb4
commit
fd519ffc40
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
|||||||
VERSION = git-20120816
|
VERSION = git-20120817
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
MANPREFIX = $(PREFIX)/share/man
|
MANPREFIX = $(PREFIX)/share/man
|
||||||
|
10
main.c
10
main.c
@ -419,7 +419,8 @@ void run(void) {
|
|||||||
int xfd;
|
int xfd;
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
XEvent ev;
|
XEvent ev, nextev;
|
||||||
|
unsigned int qlen;
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
@ -450,7 +451,13 @@ void run(void) {
|
|||||||
select(xfd + 1, &fds, 0, 0, &timeout);
|
select(xfd + 1, &fds, 0, 0, &timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
XNextEvent(win.env.dpy, &ev);
|
XNextEvent(win.env.dpy, &ev);
|
||||||
|
qlen = XEventsQueued(win.env.dpy, QueuedAlready);
|
||||||
|
if (qlen > 0)
|
||||||
|
XPeekEvent(win.env.dpy, &nextev);
|
||||||
|
} while (qlen > 0 && ev.type == nextev.type);
|
||||||
|
|
||||||
switch (ev.type) {
|
switch (ev.type) {
|
||||||
/* handle events */
|
/* handle events */
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
@ -476,6 +483,7 @@ void run(void) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
|
if (qlen == 0 || ev.xkey.keycode != nextev.xkey.keycode)
|
||||||
on_keypress(&ev.xkey);
|
on_keypress(&ev.xkey);
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
|
Loading…
Reference in New Issue
Block a user