emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a28ede3a61: t-mouse.el: Make sure we apply the setting to new ter


From: Stefan Monnier
Subject: master a28ede3a61: t-mouse.el: Make sure we apply the setting to new terminals
Date: Tue, 30 Aug 2022 17:55:12 -0400 (EDT)

branch: master
commit a28ede3a61a70cf83dfcba6c9d314fbb051a3a94
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    t-mouse.el: Make sure we apply the setting to new terminals
    
    * lisp/t-mouse.el (gpm-mouse-tty-setup): New function.
    (gpm-mouse-mode): Use it as well as `tty-setup-hook`.
    * lisp/term/linux.el (terminal-init-linux): Remove gpm-specific code,
    not neded any more.
---
 lisp/t-mouse.el    | 7 ++++++-
 lisp/term/linux.el | 2 --
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/t-mouse.el b/lisp/t-mouse.el
index cdfc30c879..7a4e7f330e 100644
--- a/lisp/t-mouse.el
+++ b/lisp/t-mouse.el
@@ -62,6 +62,9 @@
     (gpm-mouse-stop))
   (set-terminal-parameter nil 'gpm-mouse-active nil))
 
+(defun gpm-mouse-tty-setup ()
+  (if gpm-mouse-mode (gpm-mouse-enable) (gpm-mouse-disable)))
+
 ;;;###autoload
 (define-minor-mode gpm-mouse-mode
   "Toggle mouse support in GNU/Linux consoles (GPM Mouse mode).
@@ -80,7 +83,9 @@ GPM.  This is due to limitations in GPM and the Linux kernel."
                         (terminal-parameter terminal 'gpm-mouse-active))))
       ;; Simulate selecting a terminal by selecting one of its frames ;-(
       (with-selected-frame (car (frames-on-display-list terminal))
-        (if gpm-mouse-mode (gpm-mouse-enable) (gpm-mouse-disable))))))
+        (gpm-mouse-tty-setup))))
+  (when gpm-mouse-mode
+    (add-hook 'tty-setup-hook #'gpm-mouse-tty-setup)))
 
 (provide 't-mouse)
 
diff --git a/lisp/term/linux.el b/lisp/term/linux.el
index ab5a6d8698..60bf91fcf5 100644
--- a/lisp/term/linux.el
+++ b/lisp/term/linux.el
@@ -15,8 +15,6 @@
   ;; Compositions confuse cursor movement.
   (setq-default auto-composition-mode "linux")
 
-  (ignore-errors (when gpm-mouse-mode (require 't-mouse) (gpm-mouse-enable)))
-
   ;; Don't translate ESC TAB to backtab as directed
   ;; by ncurses-6.3.
   (define-key input-decode-map "\e\t" nil)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]