From ebe2a6284a64fab326ee5221599c1f1d7c2d3774 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Thu, 5 Nov 2020 01:28:14 +0000 Subject: [PATCH] X.H.EwmhDesktops: Avoid some unnecessary refreshes (border flicker) Current version of Steam sends _NET_ACTIVE_WINDOW ClientMessage for every mouse click which results in a lot of border blinking. Ignore requests that would result in no change to get rid of the annoying border flicker that is inevitable with the current implementation of XMonad.Operations.windows. (Note that Steam also sends ConfigureRequest events, and these cause an additional refresh due to the call to `float` when handling the event in xmonad core. Not sure if worth fixing.) Related: https://github.com/xmonad/xmonad-contrib/pull/371 Related: https://github.com/xmonad/xmonad-contrib/pull/399 --- XMonad/Hooks/EwmhDesktops.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/XMonad/Hooks/EwmhDesktops.hs b/XMonad/Hooks/EwmhDesktops.hs index 2ca8c3aaca..602c25e728 100644 --- a/XMonad/Hooks/EwmhDesktops.hs +++ b/XMonad/Hooks/EwmhDesktops.hs @@ -259,18 +259,18 @@ handle f ClientMessageEvent{ev_window = w, ev_message_type = mt, ev_data = d} = a_cw <- getAtom "_NET_CLOSE_WINDOW" if | mt == a_cd, n : _ <- d, Just ww <- ws !? fi n -> - windows $ W.view (W.tag ww) + if W.currentTag s == W.tag ww then mempty else windows $ W.view (W.tag ww) | mt == a_cd -> trace $ "Bad _NET_CURRENT_DESKTOP with data=" ++ show d | mt == a_d, n : _ <- d, Just ww <- ws !? fi n -> - windows $ W.shiftWin (W.tag ww) w + if W.findTag w s == Just (W.tag ww) then mempty else windows $ W.shiftWin (W.tag ww) w | mt == a_d -> trace $ "Bad _NET_WM_DESKTOP with data=" ++ show d | mt == a_aw, 2 : _ <- d -> -- when the request comes from a pager, honor it unconditionally -- https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#sourceindication windows $ W.focusWindow w - | mt == a_aw -> do + | mt == a_aw, W.peek s /= Just w -> do lh <- asks (logHook . config) XS.put (NetActivated (Just w)) lh