exwm
exwm copied to clipboard
Improve detection of focus changes
* exwm-input.el: (exwm-input--on-buffer-list-update): Keep track
of last selected window and buffer, update focus only when those
change.
(exwm-input--update-focus-defer): Add commentary.
(exwm-input--buffer-list-update-last-selected-window)
(exwm-input--buffer-list-update-last-selected-buffer): Add
variables.
(exwm-input--skip-buffer-list-update): Remove variable.
(exwm-input--on-buffer-list-update): Stop checking
`exwm-input--skip-buffer-list-update'; it's no longer needed when
keeping track selected window and buffer.
* exwm-manage.el (exwm-manage--manage-window): Remove binding of
`exwm-input--skip-buffer-list-update'.
This should limit substantially the number of on-buffer-list-updates we react to. Especially, it should ignore all with-temp-buffer, as those don't select a different window (note that we use (window-buffer (selected-window)) and not (current-buffer)).
A further improvement could be to check that the selected window belongs to an EXWM-managed frame (workspace, floating, minibuffer(?)).
Some notes: as mentioned in #706, I attributed part of the changes to @QiangF. Mentioned there as well, this should fix #705.
I haven't rigorously tested it but, while exwm-layout--refresh-workspace is still noticeable, this patch appears to help.
edit: Ah, wait, was I'm not sure if this was even supposed to help with #756.
@medranocalvo Do you think we should merge it anyway? It should help alleviate other problems at least.
Applied this to my fork https://github.com/bendlas/exwm
I think it fixes the focus problems, I've been having ..