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: Mon, 12 May 2014 00:31:48 +0300 Organization: JURTA Message-ID: <87r440gfhf.fsf@mail.jurta.org> References: <87ha50578c.fsf@mail.jurta.org> <834n0zwjne.fsf@gnu.org> <87r442ptpb.fsf@mail.jurta.org> <83r442upj2.fsf@gnu.org> <87ppjkkq20.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1399844848 10963 80.91.229.3 (11 May 2014 21:47:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 11 May 2014 21:47:28 +0000 (UTC) Cc: 17439@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 11 23:47:20 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 1Wjbaa-00082s-L4 for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 May 2014 23:47:20 +0200 Original-Received: from localhost ([::1]:34441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wjbaa-0002yq-5q for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 May 2014 17:47:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjbaQ-0002yO-8p for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 17:47:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjbaI-00014J-P7 for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 17:47:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjbaI-00013d-Lz for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 17:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WjbaI-0001PB-3v for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 17:47: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: Sun, 11 May 2014 21:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17439 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17439-submit@debbugs.gnu.org id=B17439.13998447705316 (code B ref 17439); Sun, 11 May 2014 21:47:02 +0000 Original-Received: (at 17439) by debbugs.gnu.org; 11 May 2014 21:46:10 +0000 Original-Received: from localhost ([127.0.0.1]:59779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjbZR-0001Nf-4y for submit@debbugs.gnu.org; Sun, 11 May 2014 17:46:09 -0400 Original-Received: from alc-vshost7.dreamhost.com ([69.163.216.107]:53332 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjbZN-0001NT-Pw for 17439@debbugs.gnu.org; Sun, 11 May 2014 17:46:06 -0400 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id B5C0030A1C4958; Sun, 11 May 2014 14:46:03 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sun, 11 May 2014 17:06:32 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) 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:88939 Archived-At: >> + (unless (and (consp last-input-event) >> + (symbolp (car last-input-event)) >> + (memq (car last-input-event) > > Aka (unless (memq (car-safe last-input-event) This is what I thought about, but decided to keep code consistency with `mouse-avoidance-ignore-p'. But `mouse-avoidance-ignore-p' could be optimized too. >> + '( >> + ;; `run-with-idle-timer' generates the `focus-out' > > Huh? `run-with-idle-timer' is not supposed to generate any event. It runs on `focus-out', as this short test demonstrates: (defun test () (message "%S" last-input-event)) (setq timer (run-with-idle-timer 0.1 t 'test)) It generates: (focus-in #) (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 > > Running mouse avoidance after focus-out does not seem very useful, so we > should filter out focus-out elsewhere than here. I'll move `focus-out' back to `mouse-avoidance-ignore-p' to not move the mouse pointer on `focus-out'. >> + ;; Some window managers generate the `focus-in' event >> + ;; when showing the Window List, > > What means "showing the Window List"? It depends on the desktop environment, but usually this is a list of windows shown after typing Alt-Tab. >> + ;; but `raise-frame' forcibly switches to an Emacs frame when the Window List is active, > > I don't know what this is talking about either. This is specific behavior observed at least in one window manager (Gnome 2), where typing Alt-Tab shows the Window List and generates the `focus-in' event in Emacs at the same time. >> + ;; so `focus-in' needs to be ignored here too. > > Shouldn't `switch-frame' be ignored for similar reasons, then? Currently `switch-frame' is ignored in `mouse-avoidance-ignore-p', so the mouse pointer is not moved when `switch-frame' is generated in a new frame after switching between Emacs frames. But maybe it should be handled like `focus-in', i.e. also to not ignore it in `mouse-avoidance-ignore-p' and to move the mouse pointer after switching between Emacs frames.