Don't send button events until chords are complete. - sam - An updated version of the sam text editor.
 (HTM) git clone git://vernunftzentrum.de/sam.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 0f57224765fa40eb25464f20ba2d7fcbf2adeba6
 (DIR) parent 426d401637d866670707f699b376a20c732ddb27
 (HTM) Author: Rob King <jking@deadpixi.com>
       Date:   Fri,  9 Sep 2016 22:13:21 -0500
       
       Don't send button events until chords are complete.
       
       Diffstat:
         libXg/gwin.c                        |       8 ++++++++
       
       1 file changed, 8 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/libXg/gwin.c b/libXg/gwin.c
       @@ -386,6 +386,7 @@ Mouseaction(Widget w, XEvent *e, String *p, Cardinal *np)
            int s = 0;
            int ps = 0; /* the previous state */
            int ob = 0;
       +    static bool chording = false;
        
            XButtonEvent *be = (XButtonEvent *)e;
            XMotionEvent *me = (XMotionEvent *)e;
       @@ -443,6 +444,9 @@ Mouseaction(Widget w, XEvent *e, String *p, Cardinal *np)
            if(s & Button4Mask) m.buttons |= 8;
            if(s & Button5Mask) m.buttons |= 16;
        
       +    if (!m.buttons)
       +        chording = false;
       +
            /* Check to see if it's a chord first. */
            for (Chordmapping *cm = chordmap; cm; cm = cm->next){
                if (ob == cm->s1 && m.buttons == cm->s2){
       @@ -451,9 +455,13 @@ Mouseaction(Widget w, XEvent *e, String *p, Cardinal *np)
                        (*kf)(cm->c, Kcommand, cm->t, m.xy.x, m.xy.y);
        
                    m.buttons = 0;
       +            chording = true;
                }
            }
        
       +    if (chording)
       +        m.buttons = 0;
       +
            f = ((GwinWidget)w)->gwin.gotmouse;
            if(f)
                (*f)(&m);