bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17439: 24.3.50; run-with-idle-timer runs on focus-out


From: Juri Linkov
Subject: bug#17439: 24.3.50; run-with-idle-timer runs on focus-out
Date: Sun, 11 May 2014 23:19:51 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

> So are you saying we should NOT ignore focus-in?  If you still think
> focus-in should be ignored, then I think the above description
> (perhaps together with the window manager where it was observed)
> should be in the comments to the code.

Actually, the root of the problem is `raise-frame' in
`mouse-avoidance-set-mouse-position' that brings
an Emacs frame back to the front after switching.

This is a better patch:

=== modified file 'lisp/avoid.el'
--- lisp/avoid.el       2014-01-01 07:43:34 +0000
+++ lisp/avoid.el       2014-05-11 20:15:17 +0000
@@ -177,7 +178,21 @@ (defun mouse-avoidance-set-mouse-position
   ;; difficult to do, so we just raise the frame to avoid frame switches.
   ;; Returns t if it moved the mouse.
   (let ((f (selected-frame)))
-    (raise-frame f)
+    (unless (and (consp last-input-event)
+                (symbolp (car last-input-event))
+                (memq (car last-input-event)
+                      '(
+                        ;; `run-with-idle-timer' generates the `focus-out'
+                        ;; event on switching out from the current frame,
+                        ;; but `raise-frame' brings the same frame back,
+                        ;; so ignore `focus-out' here.
+                        focus-out
+                        ;; Some window managers generate the `focus-in' event
+                        ;; when showing the Window List, but `raise-frame' 
forcibly
+                        ;; switches to an Emacs frame when the Window List is 
active,
+                        ;; so `focus-in' needs to be ignored here too.
+                        focus-in)))
+      (raise-frame f))
     (set-mouse-position f (car pos) (cdr pos))
     t))
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]