From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#17439: 24.3.50; run-with-idle-timer runs on focus-out Date: Thu, 08 May 2014 23:45:27 +0300 Organization: JURTA Message-ID: <87ha50578c.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1399582593 14857 80.91.229.3 (8 May 2014 20:56:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2014 20:56:33 +0000 (UTC) To: 17439@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 08 22:56:27 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WiVMf-0006PP-Hk for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 May 2014 22:56:25 +0200 Original-Received: from localhost ([::1]:49480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiVMf-0007KK-6R for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 May 2014 16:56:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiVMS-0007Ei-BG for bug-gnu-emacs@gnu.org; Thu, 08 May 2014 16:56:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiVMI-00044k-Gs for bug-gnu-emacs@gnu.org; Thu, 08 May 2014 16:56:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiVMI-00044g-Eo for bug-gnu-emacs@gnu.org; Thu, 08 May 2014 16:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WiVMI-0001gM-12 for bug-gnu-emacs@gnu.org; Thu, 08 May 2014 16:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 May 2014 20:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17439 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13995825036387 (code B ref -1); Thu, 08 May 2014 20:56:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 May 2014 20:55:03 +0000 Original-Received: from localhost ([127.0.0.1]:56336 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WiVLK-0001el-0v for submit@debbugs.gnu.org; Thu, 08 May 2014 16:55:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33687) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WiVLG-0001eM-Ed for submit@debbugs.gnu.org; Thu, 08 May 2014 16:54:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiVL1-00033L-5d for submit@debbugs.gnu.org; Thu, 08 May 2014 16:54:52 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:54650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiVL1-00033H-2K for submit@debbugs.gnu.org; Thu, 08 May 2014 16:54:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiVKt-0006Q2-IX for bug-gnu-emacs@gnu.org; Thu, 08 May 2014 16:54:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiVKm-00031h-31 for bug-gnu-emacs@gnu.org; Thu, 08 May 2014 16:54:35 -0400 Original-Received: from alc-vshost7.dreamhost.com ([69.163.216.107]:34991 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiVKl-00031U-Tx for bug-gnu-emacs@gnu.org; Thu, 08 May 2014 16:54:28 -0400 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id B4DAE30A28422E for ; Thu, 8 May 2014 13:54:25 -0700 (PDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:88801 Archived-At: 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 #) (focus-out #) 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.