JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Enforce ordering on focusevent types.
authorRyan McBride <mcbride@countersiege.com>
Fri, 30 Oct 2009 01:56:00 +0000 (01:56 +0000)
committerRyan McBride <mcbride@countersiege.com>
Fri, 30 Oct 2009 01:56:00 +0000 (01:56 +0000)
scrotwm.c

index a1df7b4..a2099df 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -161,7 +161,7 @@ Atom                        adelete;
 Atom                   takefocus;
 volatile sig_atomic_t   running = 1;
 int                    outputs = 0;
-int                    last_focus_event = 0;
+int                    last_focus_event = FocusOut;
 int                    (*xerrorxlib)(Display *, XErrorEvent *);
 int                    other_wm;
 int                    ss_enabled = 0;
@@ -4033,6 +4033,11 @@ focusevent(XEvent *e)
            ev->type == FocusIn ? "entering" : "leaving",
            ev->window, ev->mode, ev->detail);
 
+       if (last_focus_event == ev->type) {
+               DNPRINTF(SWM_D_FOCUS, "ignoring focusevent: bad ordering\n");
+               return;
+       }
+
        last_focus_event = ev->type;
        mode_detail = MERGE_MEMBERS(ev->mode, ev->detail);