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
This commit is contained in:
Tomas Janousek
2020-11-05 01:28:14 +00:00
parent 2fb435724f
commit ebe2a6284a

View File

@@ -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