Ignore button and key events while key-handler is running
Related to issue #253, which originally asked for a non-blocking key-handler.
This commit is contained in:
parent
c1ba841783
commit
9a85dd41d8
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
VERSION := git-20161128
|
VERSION := git-20161129
|
||||||
|
|
||||||
PREFIX := /usr/local
|
PREFIX := /usr/local
|
||||||
MANPREFIX := $(PREFIX)/share/man
|
MANPREFIX := $(PREFIX)/share/man
|
||||||
|
|
9
main.c
9
main.c
|
@ -458,6 +458,11 @@ void clear_resize(void)
|
||||||
resized = false;
|
resized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool is_input_ev(Display *dpy, XEvent *ev, XPointer arg)
|
||||||
|
{
|
||||||
|
return ev->type == ButtonPress || ev->type == KeyPress;
|
||||||
|
}
|
||||||
|
|
||||||
void run_key_handler(const char *key, unsigned int mask)
|
void run_key_handler(const char *key, unsigned int mask)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
@ -468,6 +473,7 @@ void run_key_handler(const char *key, unsigned int mask)
|
||||||
int fcnt = marked ? markcnt : 1;
|
int fcnt = marked ? markcnt : 1;
|
||||||
char kstr[32];
|
char kstr[32];
|
||||||
struct stat *oldst, st;
|
struct stat *oldst, st;
|
||||||
|
XEvent dump;
|
||||||
|
|
||||||
if (keyhandler.f.err != 0) {
|
if (keyhandler.f.err != 0) {
|
||||||
if (!keyhandler.warned) {
|
if (!keyhandler.warned) {
|
||||||
|
@ -538,6 +544,9 @@ void run_key_handler(const char *key, unsigned int mask)
|
||||||
f++;
|
f++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* drop user input events that occured while running the key handler */
|
||||||
|
while (XCheckIfEvent(win.env.dpy, &dump, is_input_ev, NULL));
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (mode == MODE_IMAGE) {
|
if (mode == MODE_IMAGE) {
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
|
Loading…
Reference in New Issue