emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/window.el,v


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/window.el,v
Date: Tue, 09 Oct 2007 08:53:06 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Miles Bader <miles>     07/10/09 08:52:58

Index: lisp/window.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/window.el,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -b -r1.124 -r1.125
--- lisp/window.el      13 Aug 2007 13:41:08 -0000      1.124
+++ lisp/window.el      9 Oct 2007 08:52:48 -0000       1.125
@@ -899,10 +899,13 @@
   "Cancel delayed window autoselection.
 Optional argument FORCE means cancel unconditionally."
   (unless (and (not force)
-              ;; Don't cancel while the user drags a scroll bar.
-              (eq this-command 'scroll-bar-toolkit-scroll)
+              ;; Don't cancel for select-window or select-frame events
+              ;; or when the user drags a scroll bar.
+              (or (memq this-command
+                        '(handle-select-window handle-switch-frame))
+                  (and (eq this-command 'scroll-bar-toolkit-scroll)
               (memq (nth 4 (event-end last-input-event))
-                    '(handle end-scroll)))
+                             '(handle end-scroll)))))
     (setq mouse-autoselect-window-state nil)
     (when (timerp mouse-autoselect-window-timer)
       (cancel-timer mouse-autoselect-window-timer))
@@ -990,16 +993,18 @@
   "Handle select-window events."
   (interactive "e")
   (let ((window (posn-window (event-start event))))
-    (when (and (window-live-p window)
+    (unless (or (not (window-live-p window))
               ;; Don't switch if we're currently in the minibuffer.
-              ;; This tries to work around problems where the minibuffer gets
-              ;; unselected unexpectedly, and where you then have to move
-              ;; your mouse all the way down to the minibuffer to select it.
-              (not (window-minibuffer-p (selected-window)))
-              ;; Don't switch to a minibuffer window unless it's active.
-              (or (not (window-minibuffer-p window))
-                  (minibuffer-window-active-p window)))
-      (unless (and (numberp mouse-autoselect-window)
+               ;; This tries to work around problems where the
+               ;; minibuffer gets unselected unexpectedly, and where
+               ;; you then have to move your mouse all the way down to
+               ;; the minibuffer to select it.
+               (window-minibuffer-p (selected-window))
+               ;; Don't switch to minibuffer window unless it's active.
+               (and (window-minibuffer-p window)
+                    (not (minibuffer-window-active-p window)))
+               ;; Don't switch when autoselection shall be delayed.
+               (and (numberp mouse-autoselect-window)
                   (not (zerop mouse-autoselect-window))
                   (not (eq mouse-autoselect-window-state 'select))
                   (progn
@@ -1010,13 +1015,17 @@
                     (mouse-autoselect-window-start (mouse-position) window)
                     ;; Executing a command cancels delayed autoselection.
                     (add-hook
-                     'pre-command-hook 'mouse-autoselect-window-cancel)))
+                       'pre-command-hook 'mouse-autoselect-window-cancel))))
+      (when mouse-autoselect-window
        ;; Reset state of delayed autoselection.
        (setq mouse-autoselect-window-state nil)
-       (when mouse-autoselect-window
+       ;; Set input focus to handle cross-frame movement.  Bind
+       ;; `focus-follows-mouse' to avoid moving the mouse cursor.
+       (let (focus-follows-mouse)
+         (select-frame-set-input-focus (window-frame window)))
          ;; Run `mouse-leave-buffer-hook' when autoselecting window.
          (run-hooks 'mouse-leave-buffer-hook))
-       (select-window window)))))
+      (select-window window))))
 
 (define-key ctl-x-map "2" 'split-window-vertically)
 (define-key ctl-x-map "3" 'split-window-horizontally)




reply via email to

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