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: Mon, 12 May 2014 23:39:23 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

>>>> + ;;  but `raise-frame' forcibly switches to an Emacs frame
>>>> when the Window List is active,
>
> Well, this behavior is a choice of the window-manager.  While I'm very
> happy to call raise-frame less often (so I generally agree with the
> direction of the patch), you could argue that this might be a bug in the
> window-manager.

raise-frame causes more trouble, e.g. when another application is
in full-screen mode, then they both fight for which of them should stay
on the top, so typing a key in Emacs re-raises the selected Emacs frame,
and then another application brings itself to the front.

A comment in `mouse-avoidance-set-mouse-position' explains its rationale:

  ;; Ideally, should check if X,Y is in the current frame, and if not,
  ;; leave the mouse where it was.  However, this is currently
  ;; difficult to do, so we just raise the frame to avoid frame switches.

But actually such check already exists in `mouse-avoidance-ignore-p':

        (not (eq (car (mouse-position)) (selected-frame)))

and the mouse pointer is not moved when it's outside of the selected frame.

So I really see no problems with this patch:

=== modified file 'lisp/avoid.el'
--- lisp/avoid.el       2014-01-01 07:43:34 +0000
+++ lisp/avoid.el       2014-05-12 20:31:28 +0000
@@ -52,9 +52,6 @@
 ;;
 ;; - Using this code does slow Emacs down.  "banish" mode shouldn't
 ;;   be too bad, and on my workstation even "animate" is reasonable.
-;;
-;; - It ought to find out where any overlapping frames are and avoid them,
-;;   rather than always raising the frame.
 
 ;; Credits:
 ;; This code was helped by all those who contributed suggestions,
@@ -172,12 +170,8 @@ (defun mouse-avoidance-point-position ()
 
 (defun mouse-avoidance-set-mouse-position (pos)
   ;; Carefully set mouse position to given position (X . Y)
-  ;; Ideally, should check if X,Y is in the current frame, and if not,
-  ;; leave the mouse where it was.  However, this is currently
-  ;; 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)
     (set-mouse-position f (car pos) (cdr pos))
     t))
 
@@ -342,7 +336,7 @@ (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 focus-out))
                   (memq 'click modifiers)
                   (memq 'double modifiers)
                   (memq 'triple modifiers)
@@ -403,8 +403,6 @@ (defun mouse-avoidance-mode (&optional m
  * cat-and-mouse: Same as `animate'.
  * proteus: As `animate', but changes the shape of the mouse pointer too.
 
-Whenever the mouse is moved, the frame is also raised.
-
 \(See `mouse-avoidance-threshold' for definition of \"too close\",
 and `mouse-avoidance-nudge-dist' and `mouse-avoidance-nudge-var' for
 definition of \"random distance\".)"






reply via email to

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