From 3a140badf52a7ce5676a3dc240265be136593f9c Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Sat, 24 Dec 2016 21:01:44 -0600 Subject: [PATCH] Don't send focus events for the wrong windows Prevents focus switching loop with UpdatePointer. From https://code.google.com/archive/p/xmonad/issues/200 --- src/XMonad/Main.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/XMonad/Main.hs b/src/XMonad/Main.hs index 57c13c8..6fd8e1a 100644 --- a/src/XMonad/Main.hs +++ b/src/XMonad/Main.hs @@ -357,7 +357,11 @@ handle e@(ButtonEvent {ev_window = w,ev_event_type = t,ev_button = b }) -- True in the user's config. handle e@(CrossingEvent {ev_window = w, ev_event_type = t}) | t == enterNotify && ev_mode e == notifyNormal - = whenX (asks $ focusFollowsMouse . config) (focus w) + = whenX (asks $ focusFollowsMouse . config) $ do + dpy <- asks display + root <- asks theRoot + (_, _, w', _, _, _, _, _) <- io $ queryPointer dpy root + when (w == w') (focus w) -- left a window, check if we need to focus root handle e@(CrossingEvent {ev_event_type = t})