Function: select-frame-set-input-focus
select-frame-set-input-focus is a byte-compiled function defined in
frame.el.gz.
Signature
(select-frame-set-input-focus FRAME &optional NORECORD)
Documentation
Select FRAME, raise it, and set input focus, if possible.
If mouse-autoselect-window is non-nil, also move mouse pointer
to FRAME's selected window. Otherwise, if focus-follows-mouse
is non-nil, move mouse cursor to FRAME.
Optional argument NORECORD means to neither change the order of recently selected windows nor the buffer list.
Aliases
org-select-frame-set-input-focus (obsolete since 9.0)
Source Code
;; Defined in /usr/src/emacs/lisp/frame.el.gz
(defun select-frame-set-input-focus (frame &optional norecord)
"Select FRAME, raise it, and set input focus, if possible.
If `mouse-autoselect-window' is non-nil, also move mouse pointer
to FRAME's selected window. Otherwise, if `focus-follows-mouse'
is non-nil, move mouse cursor to FRAME.
Optional argument NORECORD means to neither change the order of
recently selected windows nor the buffer list."
(select-frame frame norecord)
(raise-frame frame)
;; Ensure, if possible, that FRAME gets input focus.
(when (display-multi-frame-p frame)
(x-focus-frame frame))
;; Move mouse cursor if necessary.
(cond
(mouse-autoselect-window
(let ((edges (window-edges (frame-selected-window frame)
t nil t)))
;; Move mouse cursor into FRAME's selected window to avoid that
;; Emacs mouse-autoselects another window.
(set-mouse-pixel-position frame (1- (nth 2 edges)) (nth 1 edges))))
(focus-follows-mouse
;; Move mouse cursor into FRAME to avoid that another frame gets
;; selected by the window manager.
(set-mouse-position frame (1- (frame-width frame)) 0))))