From 46fe7a17f53ab7026f3a11442a07233f37984456 Mon Sep 17 00:00:00 2001 From: Jared Finder Date: Sat, 9 Dec 2023 10:17:05 +0200 Subject: [PATCH] Fix dragging mode line on text terminals with a mouse (bug#67457) * lisp/xt-mouse.el (xterm-mouse-translate-1): Fix the 'event-kind' property of mouse-movement symbols emitted by xt-mouse. * lisp/term/linux.el (terminal-init-linux): Call 'gpm-mouse-mode' to set up the terminal for the mouse, if needed. --- lisp/term/linux.el | 6 +++++- lisp/xt-mouse.el | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lisp/term/linux.el b/lisp/term/linux.el index f24af3f1344..491649a053d 100644 --- a/lisp/term/linux.el +++ b/lisp/term/linux.el @@ -13,9 +13,13 @@ ;; Compositions confuse cursor movement. (setq-default auto-composition-mode "linux") + ;; Ensure additional terminal setup is done when `gpm-mouse-mode' is + ;; enabled. + (ignore-errors (when gpm-mouse-mode (gpm-mouse-mode 1))) + ;; Don't translate ESC TAB to backtab as directed by ncurses-6.3. (define-key input-decode-map "\e\t" nil) - + ;; Make Latin-1 input characters work, too. ;; Meta will continue to work, because the kernel turns that into Escape. diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 4ccd35d5277..2e927c0e32e 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -63,9 +63,13 @@ https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)." (is-move (eq 'mouse-movement ev-command)) (is-down (string-match "down-" (symbol-name ev-command)))) - ;; Mouse events symbols must have an 'event-kind property with - ;; the value 'mouse-click. - (when ev-command (put ev-command 'event-kind 'mouse-click)) + ;; Mouse events symbols must have an 'event-kind property set. + ;; Most of them use the value 'mouse-click, but 'mouse-movement has + ;; a different value. See head_table in keyboard.c. (bug#67457) + (when ev-command (put ev-command 'event-kind + (if (eq ev-command 'mouse-movement) + 'mouse-movement + 'mouse-click))) (cond ((null event) nil) ;Unknown/bogus byte sequence! -- 2.39.2