Calling XSetInputFocus() with non-"stale" time. I believe a change in Xorg facilitated this bug where, occasionally, a FocusOut event would immediately follow a FocusIn event, leaving focus reverted to Root window. References: https://bugs.freedesktop.org/show_bug.cgi?id=83900 http://marc.info/?l=openbsd-misc&m=141067888307365&w=2 --- src/Window.cc.orig Tue Oct 18 10:01:41 2005 +++ src/Window.cc Tue Apr 25 16:42:41 2017 @@ -43,6 +43,7 @@ #endif #include +#include /* sometimes C++ is a pain in the ass... it gives us stuff like the @@ -2194,7 +2195,7 @@ bool BlackboxWindow::setInputFocus(void) { } XSetInputFocus(blackbox->XDisplay(), client.window, - RevertToPointerRoot, blackbox->XTime()); + RevertToPointerRoot, CurrentTime); if (client.wmprotocols.wm_take_focus) { XEvent ce;