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

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

[debbugs-tracker] bug#17439: closed (24.3.50; run-with-idle-timer runs o


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#17439: closed (24.3.50; run-with-idle-timer runs on focus-out)
Date: Tue, 20 May 2014 21:16:02 +0000

Your message dated Wed, 21 May 2014 00:14:57 +0300
with message-id <address@hidden>
and subject line Re: bug#17439: 24.3.50; run-with-idle-timer runs on focus-out
has caused the debbugs.gnu.org bug report #17439,
regarding 24.3.50; run-with-idle-timer runs on focus-out
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
17439: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17439
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.3.50; run-with-idle-timer runs on focus-out Date: Thu, 08 May 2014 23:45:27 +0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)
Some change a few months ago introduced a significant inconvenience.
After switching to another application, the focus returns back to Emacs.
It happens when using `mouse-avoidance-mode' customized to `banish'.
This mode relies on `run-with-idle-timer' that moves the mouse cursor
on a new input.  This caused no problems in prior releases.

However, now input events include a new event type `focus-out',
so the mouse cursor is moved on switching from Emacs frame
(and the new mouse cursor position puts the focus back
due to specific configuration).

This code illustrates the problem:

(defun test () (message "%S" last-input-event))
(setq timer (run-with-idle-timer 0.1 t 'test))

On switching out it prints to *Messages*:

(focus-in #<frame address@hidden 0x1121908>)
(focus-out #<frame address@hidden 0x1121908>)

This specific problem can be fixed by this patch:

=== modified file 'lisp/avoid.el'
--- lisp/avoid.el       2014-01-31 06:42:29 +0000
+++ lisp/avoid.el       2014-05-08 20:39:59 +0000
@@ -343,7 +343,8 @@ (defun mouse-avoidance-ignore-p ()
                 (let ((modifiers (event-modifiers (car last-input-event))))
                   (or (memq (car last-input-event)
                             '(mouse-movement scroll-bar-movement
-                                             select-window switch-frame))
+                                             select-window switch-frame
+                                             focus-in focus-out))
                       (memq 'click modifiers)
                       (memq 'double modifiers)
                       (memq 'triple modifiers)

PS: it seems there are other places that check only for `switch-frame',
and not for new event types `focus-in' and `focus-out'.  But maybe
this problem occurs only in `run-with-idle-timer' because switching out
doesn't emit the event on its own, i.e. `read-event' doesn't return it.



--- End Message ---
--- Begin Message --- Subject: Re: bug#17439: 24.3.50; run-with-idle-timer runs on focus-out Date: Wed, 21 May 2014 00:14:57 +0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)
>> So I really see no problems with this patch:
>
> If that works, then by all means go for it.

Installed (found no problems after more testing).


--- End Message ---

reply via email to

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