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: Sun, 11 May 2014 23:19:51 +0300 Organization: JURTA Message-ID: <87ppjkkq20.fsf@mail.jurta.org> References: <87ha50578c.fsf@mail.jurta.org> <834n0zwjne.fsf@gnu.org> <87r442ptpb.fsf@mail.jurta.org> <83r442upj2.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1399841008 29275 80.91.229.3 (11 May 2014 20:43:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 11 May 2014 20:43:28 +0000 (UTC) Cc: 17439@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 11 22:43:21 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 1Wjaaf-0002BG-9K for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 May 2014 22:43:21 +0200 Original-Received: from localhost ([::1]:34305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wjaae-0007AJ-Rh for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 May 2014 16:43:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjaaU-0007AB-1f for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 16:43:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjaaM-0007Zp-D3 for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 16:43:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjaaM-0007Zl-A4 for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 16:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WjaaM-0006ya-20 for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 16:43: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 20:43:01 +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.139984095626775 (code B ref 17439); Sun, 11 May 2014 20:43:01 +0000 Original-Received: (at 17439) by debbugs.gnu.org; 11 May 2014 20:42:36 +0000 Original-Received: from localhost ([127.0.0.1]:59708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjaZv-0006xn-JQ for submit@debbugs.gnu.org; Sun, 11 May 2014 16:42:35 -0400 Original-Received: from alc-vshost7.dreamhost.com ([69.163.216.107]:38410 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjaZs-0006xb-Kv for 17439@debbugs.gnu.org; Sun, 11 May 2014 16:42:33 -0400 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 7AFE4325F7AB91; Sun, 11 May 2014 13:42:30 -0700 (PDT) In-Reply-To: <83r442upj2.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 10 May 2014 09:16:33 +0300") 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:88932 Archived-At: > 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))