Variable: mouse-autoselect-window
mouse-autoselect-window is a customizable variable defined in xdisp.c.
Value
nil
Documentation
Non-nil means autoselect window with mouse pointer.
If nil, do not autoselect windows. A positive number means delay autoselection by that many seconds: a window is autoselected only after the mouse has remained in that window for the duration of the delay. A negative number has a similar effect, but causes windows to be autoselected only after the mouse has stopped moving. (Because of the way Emacs compares mouse events, you will occasionally wait twice that time before the window gets selected.) Any other value means to autoselect window instantaneously when the mouse pointer enters it.
Autoselection selects the minibuffer only if it is active, and never unselects the minibuffer if it is active.
If you want to use the mouse to autoselect a window on another frame,
make sure that (1) your window manager has focus follow the mouse and
(2) the value of the option focus-follows-mouse matches the policy
of your window manager.
This variable was added, or its default value changed, in Emacs 22.1.
Probably introduced at or before Emacs version 22.1.
Source Code
// Defined in /usr/src/emacs/src/xdisp.c
DEFVAR_LISP ("mouse-autoselect-window", Vmouse_autoselect_window,
doc: /* Non-nil means autoselect window with mouse pointer.
If nil, do not autoselect windows.
A positive number means delay autoselection by that many seconds: a
window is autoselected only after the mouse has remained in that
window for the duration of the delay.
A negative number has a similar effect, but causes windows to be
autoselected only after the mouse has stopped moving. (Because of
the way Emacs compares mouse events, you will occasionally wait twice
that time before the window gets selected.)
Any other value means to autoselect window instantaneously when the
mouse pointer enters it.
Autoselection selects the minibuffer only if it is active, and never
unselects the minibuffer if it is active.
If you want to use the mouse to autoselect a window on another frame,
make sure that (1) your window manager has focus follow the mouse and
(2) the value of the option `focus-follows-mouse' matches the policy
of your window manager. */);