mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-22 07:09:54 +00:00
Support 'mouse-autoselect-window' in xterm-mouse
Generate select-window events, so that 'mouse-autoselect-window' takes effect on TTY frames, when 'xterm-mouse-mode' is enabled. * lisp/xt-mouse.el (xterm-mouse-translate-1): If 'mouse-autoselect-window' is non-nil, add select-window events to 'unread-command-events'. (Bug#69915)
This commit is contained in:
parent
617bd85cd0
commit
abe39d5788
@ -60,7 +60,9 @@ https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
|
|||||||
(let* ((event (xterm-mouse-event extension))
|
(let* ((event (xterm-mouse-event extension))
|
||||||
(ev-command (nth 0 event))
|
(ev-command (nth 0 event))
|
||||||
(ev-data (nth 1 event))
|
(ev-data (nth 1 event))
|
||||||
|
(ev-window (nth 0 ev-data))
|
||||||
(ev-where (nth 1 ev-data))
|
(ev-where (nth 1 ev-data))
|
||||||
|
(last-window (terminal-parameter nil 'xterm-mouse-last-window))
|
||||||
(vec (vector event))
|
(vec (vector event))
|
||||||
(is-move (eq 'mouse-movement ev-command))
|
(is-move (eq 'mouse-movement ev-command))
|
||||||
(is-down (string-match "down-" (symbol-name ev-command))))
|
(is-down (string-match "down-" (symbol-name ev-command))))
|
||||||
@ -73,6 +75,9 @@ https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
|
|||||||
'mouse-movement
|
'mouse-movement
|
||||||
'mouse-click)))
|
'mouse-click)))
|
||||||
|
|
||||||
|
;; remember window of current mouse position
|
||||||
|
(set-terminal-parameter nil 'xterm-mouse-last-window ev-window)
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
((null event) nil) ;Unknown/bogus byte sequence!
|
((null event) nil) ;Unknown/bogus byte sequence!
|
||||||
(is-down
|
(is-down
|
||||||
@ -84,10 +89,22 @@ https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
|
|||||||
vec)
|
vec)
|
||||||
(is-move
|
(is-move
|
||||||
(xterm-mouse--handle-mouse-movement)
|
(xterm-mouse--handle-mouse-movement)
|
||||||
(if track-mouse vec
|
;; after mouse movement autoselect the mouse window, but ...
|
||||||
;; Mouse movement events are currently supposed to be
|
(cond ((and mouse-autoselect-window
|
||||||
;; suppressed. Return no event.
|
;; ignore modeline, tab-bar, menu-bar and so forth ...
|
||||||
[]))
|
(windowp ev-window)
|
||||||
|
;; and don't deselect the minibuffer ...
|
||||||
|
(not (window-minibuffer-p (selected-window)))
|
||||||
|
;; and select only, if mouse is over a new window ...
|
||||||
|
(not (eq ev-window last-window))
|
||||||
|
;; which is different from the selected window
|
||||||
|
(not (eq ev-window (selected-window))))
|
||||||
|
(put 'select-window 'event-kind 'switch-frame)
|
||||||
|
(push `(select-window (,ev-window)) unread-command-events)
|
||||||
|
[])
|
||||||
|
;;(vector `(select-window (,ev-window))))
|
||||||
|
(track-mouse vec)
|
||||||
|
(t [])))
|
||||||
(t
|
(t
|
||||||
(let* ((down (terminal-parameter nil 'xterm-mouse-last-down))
|
(let* ((down (terminal-parameter nil 'xterm-mouse-last-down))
|
||||||
(down-data (nth 1 down))
|
(down-data (nth 1 down))
|
||||||
|
Loading…
Reference in New Issue
Block a user