From: Ryan McBride Date: Fri, 30 Oct 2009 01:56:00 +0000 (+0000) Subject: Enforce ordering on focusevent types. X-Git-Url: https://jasonwoof.com/gitweb/?a=commitdiff_plain;h=1332091a8e59e013803bb3021f0d4e2700a8e222;p=spectrwm.git Enforce ordering on focusevent types. --- diff --git a/scrotwm.c b/scrotwm.c index a1df7b4..a2099df 100644 --- 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);