aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/frame.el43
1 files changed, 19 insertions, 24 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index 8acafa9c690..cbf4c9f1372 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -841,24 +841,26 @@ the user during startup."
841(declare-function x-focus-frame "xfns.c" (frame)) 841(declare-function x-focus-frame "xfns.c" (frame))
842 842
843(defun select-frame-set-input-focus (frame) 843(defun select-frame-set-input-focus (frame)
844 "Select FRAME, raise it, and set input focus, if possible." 844 "Select FRAME, raise it, and set input focus, if possible.
845If `mouse-autoselect-window' is non-nil, also move mouse cursor
846to FRAME's selected window. Otherwise, if `focus-follows-mouse'
847is non-nil, move mouse cursor to FRAME."
845 (select-frame frame) 848 (select-frame frame)
846 (raise-frame frame) 849 (raise-frame frame)
847 ;; Ensure, if possible, that frame gets input focus. 850 ;; Ensure, if possible, that FRAME gets input focus.
848 (when (memq (window-system frame) '(x w32 ns)) 851 (when (memq (window-system frame) '(x w32 ns))
849 (x-focus-frame frame)) 852 (x-focus-frame frame))
850 (when focus-follows-mouse 853 ;; Move mouse cursor if necessary.
851 ;; When the mouse cursor is not in FRAME's selected window move it 854 (cond
852 ;; there to avoid that some other window gets selected when focus 855 (mouse-autoselect-window
853 ;; follows mouse. 856 (let ((edges (window-inside-edges (frame-selected-window frame))))
854 (condition-case nil 857 ;; Move mouse cursor into FRAME's selected window to avoid that
855 (let ((window (frame-selected-window frame)) 858 ;; Emacs mouse-autoselects another window.
856 (coordinates (cdr-safe (mouse-position)))) 859 (set-mouse-position frame (nth 2 edges) (nth 1 edges))))
857 (unless (and (car-safe coordinates) 860 (focus-follows-mouse
858 (coordinates-in-window-p coordinates window)) 861 ;; Move mouse cursor into FRAME to avoid that another frame gets
859 (let ((edges (window-inside-edges (frame-selected-window frame)))) 862 ;; selected by the window manager.
860 (set-mouse-position frame (nth 2 edges) (nth 1 edges))))) 863 (set-mouse-position frame (1- (frame-width frame)) 0))))
861 (error nil))))
862 864
863(defun other-frame (arg) 865(defun other-frame (arg)
864 "Select the ARGth different visible frame on current display, and raise it. 866 "Select the ARGth different visible frame on current display, and raise it.
@@ -934,16 +936,9 @@ If there is no frame by that name, signal an error."
934 (list input)))) 936 (list input))))
935 (let* ((frame-names-alist (make-frame-names-alist)) 937 (let* ((frame-names-alist (make-frame-names-alist))
936 (frame (cdr (assoc name frame-names-alist)))) 938 (frame (cdr (assoc name frame-names-alist))))
937 (or frame 939 (if frame
938 (error "There is no frame named `%s'" name)) 940 (select-frame-set-input-focus frame)
939 (make-frame-visible frame) 941 (error "There is no frame named `%s'" name))))
940 (raise-frame frame)
941 (select-frame frame)
942 ;; Ensure, if possible, that frame gets input focus.
943 (cond ((memq (window-system frame) '(x w32 ns))
944 (x-focus-frame frame)))
945 (when focus-follows-mouse
946 (set-mouse-position frame (1- (frame-width frame)) 0))))
947 942
948;;;; Frame configurations 943;;;; Frame configurations
949 944