Hi, Digging more after I couldn't reproduce the issue with "stock" fvwm, I believe the problem is blackbox's code calling XSetInputFocus() with a "stale" time. With attached patch I am unable to reproduce the issue.
Would appreciate if this could be put in. Certainly a change in X made this bug show up. If any X11 guru knows what change, I'm very curious to find out. Cheers, --patrick On 9/14/14, patrick keshishian <[email protected]> wrote: > Visual aid demonstraiting the issue described here: > > http://youtu.be/gl49UBVOUog > > --patrick > > On 9/14/14, patrick keshishian <[email protected]> wrote: >> Hi, >> >> Moving to 2014-SEP-09 snapshot (amd64)[1] I started to notice >> something strange with my wm (blackbox) and window focus >> events. I have it set to "sloppy" focus, where focus follows the >> mouse, but doesn't leave the last visited window, until the mouse >> enters a new window. >> >> Every so often moving the mouse from one window to another, >> the latter does not get focus. >> >> I tried to capture the condition with xev. Here the first sequence >> of EnterNotify -> KeymapNotify -> FocusIn -> LeaveNotify -> >> FocusOut shows an expected behavior where mouse moved >> from xterm to xev window, xev window: >> >> 1. EnterNotify (mouse moved from xterm -> xev window) >> 2. FocusIn (xev window got focus) >> 3. bunch of MotionNotify events as mouse moved around >> 4. LeaveNotify (mouse left xev window) >> 5. FocusOut (mouse entered xterm window) >> >> EnterNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82741873, (13,137), root:(960,467), >> mode NotifyNormal, detail NotifyAncestor, same_screen YES, >> focus NO, state 0 >> >> KeymapNotify event, serial 35, synthetic NO, window 0x0, >> keys: 4294967224 0 0 0 0 0 0 0 0 0 0 0 0 0 >> 0 >> 0 >> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82741877, (13,137), root:(960,467), >> state 0x0, is_hint 0, same_screen YES >> >> FocusIn event, serial 35, synthetic NO, window 0x1c00001, >> mode NotifyNormal, detail NotifyNonlinear >> >> KeymapNotify event, serial 35, synthetic NO, window 0x0, >> keys: 4294967224 0 0 0 0 0 0 0 0 0 0 0 0 0 >> 0 >> 0 >> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82741889, (47,139), root:(994,469), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82741903, (72,139), root:(1019,469), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82741913, (82,139), root:(1029,469), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82741926, (84,139), root:(1031,469), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82741937, (84,139), root:(1031,469), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742392, (79,139), root:(1026,469), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742404, (67,138), root:(1014,468), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742416, (41,134), root:(988,464), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742428, (10,133), root:(957,463), >> state 0x0, is_hint 0, same_screen YES >> >> LeaveNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742433, (-22,131), root:(925,461), >> mode NotifyNormal, detail NotifyAncestor, same_screen YES, >> focus YES, state 0 >> >> FocusOut event, serial 35, synthetic NO, window 0x1c00001, >> mode NotifyNormal, detail NotifyNonlinear >> >> >> This next sequence shows the problem: >> >> 1. EnterNotify (mouse moved from xterm -> xev window) >> 2. FocusIn (xev window got focus - briefly?) >> 3. FocusOut (mouse still in xev window, but window w/o focus) >> XXX What happened here? >> 4. bunch of MotionNotify events as mouse moved around >> 5. LeaveNotify (mouse left xev window) >> >> Notice no FocusOut event at the end of the sequence. Why >> did the FocusOut event happen early? What causes this? >> >> >> EnterNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742834, (23,139), root:(970,469), >> mode NotifyNormal, detail NotifyAncestor, same_screen YES, >> focus NO, state 0 >> >> KeymapNotify event, serial 35, synthetic NO, window 0x0, >> keys: 4294967224 0 0 0 0 0 0 0 0 0 0 0 0 0 >> 0 >> 0 >> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742837, (23,139), root:(970,469), >> state 0x0, is_hint 0, same_screen YES >> >> FocusIn event, serial 35, synthetic NO, window 0x1c00001, >> mode NotifyNormal, detail NotifyNonlinear >> >> KeymapNotify event, serial 35, synthetic NO, window 0x0, >> keys: 4294967224 0 0 0 0 0 0 0 0 0 0 0 0 0 >> 0 >> 0 >> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> >> FocusOut event, serial 35, synthetic NO, window 0x1c00001, >> mode NotifyNormal, detail NotifyNonlinear >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742850, (66,139), root:(1013,469), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742862, (101,139), root:(1048,469), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742874, (126,139), root:(1073,469), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82742886, (132,139), root:(1079,469), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82752228, (132,143), root:(1079,473), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82752240, (132,144), root:(1079,474), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82752252, (132,149), root:(1079,479), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82752264, (132,154), root:(1079,484), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82752275, (132,159), root:(1079,489), >> state 0x0, is_hint 0, same_screen YES >> >> MotionNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82752288, (132,170), root:(1079,500), >> state 0x0, is_hint 0, same_screen YES >> >> LeaveNotify event, serial 35, synthetic NO, window 0x1c00001, >> root 0x2b8, subw 0x0, time 82752294, (132,185), root:(1079,515), >> mode NotifyNormal, detail NotifyNonlinear, same_screen YES, >> focus NO, state 0 >> >> >> Anyone else seeing this behavior, possibly with other WMs? >> Thoughts as to the cause? or when this might have been >> introduced? My last snapshot was pretty old (2014-MAR-21) >> and didn't display this issue. >> >> --patrick >> >> [1] dmesg: >> OpenBSD 5.6-current (GENERIC.MP) #368: Tue Sep 9 00:28:20 MDT 2014 >> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP [dd]
Index: Makefile =================================================================== RCS file: /cvs/obsd/ports/x11/blackbox/Makefile,v retrieving revision 1.52 diff -u -p -u -p -r1.52 Makefile --- Makefile 1 Sep 2013 12:49:09 -0000 1.52 +++ Makefile 16 Sep 2014 01:56:03 -0000 @@ -3,7 +3,7 @@ COMMENT= small & pretty window manager for 8 and more bits displays DISTNAME= blackbox-0.70.1 -REVISION= 4 +REVISION= 5 CATEGORIES= x11 HOMEPAGE= http://blackboxwm.sourceforge.net/ Index: patches/patch-src_Window_cc =================================================================== RCS file: patches/patch-src_Window_cc diff -N patches/patch-src_Window_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_Window_cc 16 Sep 2014 01:56:03 -0000 @@ -0,0 +1,21 @@ +$OpenBSD$ + +- 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 Mon Sep 15 18:35:18 2014 ++++ src/Window.cc Mon Sep 15 18:35:33 2014 +@@ -2194,7 +2194,7 @@ bool BlackboxWindow::setInputFocus(void) { + } + + XSetInputFocus(blackbox->XDisplay(), client.window, +- RevertToPointerRoot, blackbox->XTime()); ++ RevertToPointerRoot, CurrentTime); + + if (client.wmprotocols.wm_take_focus) { + XEvent ce;
