(wrong string) ünnich

From: <git_AT_suckless.org>
Date: Wed, 30 Nov 2016 20:49:44 +0100 (CET)

commit 9a85dd41d8551f82a5d00c8e0dd0807e23bbdc6d
Author: Bert Münnich <ber.t_AT_posteo.de>
AuthorDate: Tue Nov 29 12:07:08 2016 +0100
Commit: Bert Münnich <ber.t_AT_posteo.de>
CommitDate: Wed Nov 30 20:48:32 2016 +0100

    Ignore button and key events while key-handler is running
    
    Related to issue #253, which originally asked for a non-blocking key-handler.

diff --git a/Makefile b/Makefile
index 07fff5e..3db5ade 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -1,4 +1,4 @@
-VERSION := git-20161128
+VERSION := git-20161129
 
 PREFIX := /usr/local
 MANPREFIX := $(PREFIX)/share/man
diff --git a/main.c b/main.c
index d1813a5..131fdec 100644
--- a/main.c
+++ b/main.c
_AT_@ -458,6 +458,11 @@ void clear_resize(void)
         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)
 {
         pid_t pid;
_AT_@ -468,6 +473,7 @@ void run_key_handler(const char *key, unsigned int mask)
         int fcnt = marked ? markcnt : 1;
         char kstr[32];
         struct stat *oldst, st;
+ XEvent dump;
 
         if (keyhandler.f.err != 0) {
                 if (!keyhandler.warned) {
_AT_@ -538,6 +544,9 @@ void run_key_handler(const char *key, unsigned int mask)
                         f++;
                 }
         }
+ /* drop user input events that occured while running the key handler */
+ while (XCheckIfEvent(win.env.dpy, &dump, is_input_ev, NULL));
+
 end:
         if (mode == MODE_IMAGE) {
                 if (changed) {
Received on Wed Nov 30 2016 - 20:49:44 CET

This archive was generated by hypermail 2.3.0 : Wed Nov 30 2016 - 21:00:15 CET