I use mpd and ncmpcpp. mpd allows sending sound data to a fifo, and ncmpcpp can read from that fifo and do sound visualizations with the data. So when mpd is playing, it is constantly writing to the fifo and generating file-notify events. I'm not entirely sure why Emacs is receiving these events, but it is, and it causes mouse avoidance to kick in without typing. I can't reproduce the the problem reliably, but it occurs regularly. The attached patch fixes it for me, and it just makes sense for mouse-avoidance-ignore-p to ignore file-notify events. I'm not sure if there are additional types of events that it should also ignore; I couldn't find an exhaustive list of all the event types.
diff --git a/lisp/avoid.el b/lisp/avoid.el
index 3d43539..e42e08a 100644
@@ -335,7 +335,7 @@ redefine this function to suit your own tastes."
(let ((modifiers (event-modifiers (car last-input-event))))
(or (memq (car last-input-event)
- select-window focus-out))
+ select-window focus-out file-notify))
(memq 'click modifiers)
(memq 'double modifiers)
(memq 'triple modifiers)
It always takes longer than you expect, even
when you take into account Hofstadter's Law.