# HG changeset patch # User Dan Nicolaescu # Date 1189816058 0 # Node ID d1fd48a6a8ed8b3a69d398a64e225cac95b7db62 # Parent cad259e522a57e791b7e929d62aff87b1a566740 * xt-mouse.el (xterm-mouse-mode): Add hooks here not at the top level. Remove the hooks when turning off the mode. * term/xterm.el: Require xt-mouse at compile time. (terminal-init-xterm): Turn on xterm mouse tracking for this terminal if xterm-mouse-mode is enabled. diff -r cad259e522a5 -r d1fd48a6a8ed lisp/ChangeLog --- a/lisp/ChangeLog Fri Sep 14 22:58:55 2007 +0000 +++ b/lisp/ChangeLog Sat Sep 15 00:27:38 2007 +0000 @@ -1,3 +1,12 @@ +2007-09-15 Dan Nicolaescu + + * xt-mouse.el (xterm-mouse-mode): Add hooks here not at the top + level. Remove the hooks when turning off the mode. + + * term/xterm.el: Require xt-mouse at compile time. + (terminal-init-xterm): Turn on xterm mouse tracking for this + terminal if xterm-mouse-mode is enabled. + 2007-09-14 Dan Nicolaescu * term/xterm.el (xterm-function-map): Replace bindings that were diff -r cad259e522a5 -r d1fd48a6a8ed lisp/term/xterm.el --- a/lisp/term/xterm.el Fri Sep 14 22:58:55 2007 +0000 +++ b/lisp/term/xterm.el Sat Sep 15 00:27:38 2007 +0000 @@ -27,6 +27,8 @@ ;;; Code: +(eval-when-compile (require 'xt-mouse)) + (defvar xterm-function-map (let ((map (make-sparse-keymap))) @@ -455,7 +457,11 @@ (xterm-register-default-colors) ;; This recomputes all the default faces given the colors we've just set up. (tty-set-up-initial-frame-faces) - + + (when xterm-mouse-mode + (turn-on-xterm-mouse-tracking-on-terminal + (frame-terminal (selected-frame)))) + ;; Try to turn on the modifyOtherKeys feature on modern xterms. ;; When it is turned on much more key bindings work: things like ;; C-. C-, etc. diff -r cad259e522a5 -r d1fd48a6a8ed lisp/xt-mouse.el --- a/lisp/xt-mouse.el Fri Sep 14 22:58:55 2007 +0000 +++ b/lisp/xt-mouse.el Sat Sep 15 00:27:38 2007 +0000 @@ -208,9 +208,32 @@ (if xterm-mouse-mode ;; Turn it on (progn + ;; Frame creation and deletion. + (add-hook 'after-make-frame-functions + 'turn-on-xterm-mouse-tracking-on-terminal) + (add-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame) + + ;; Restore normal mouse behaviour outside Emacs. + (add-hook 'suspend-tty-functions + 'turn-off-xterm-mouse-tracking-on-terminal) + (add-hook 'resume-tty-functions + 'turn-on-xterm-mouse-tracking-on-terminal) + (add-hook 'suspend-hook 'turn-off-xterm-mouse-tracking) + (add-hook 'suspend-resume-hook 'turn-on-xterm-mouse-tracking) + (add-hook 'kill-emacs-hook 'turn-off-xterm-mouse-tracking) (setq mouse-position-function #'xterm-mouse-position-function) (turn-on-xterm-mouse-tracking)) ;; Turn it off + (remove-hook 'after-make-frame-functions + 'turn-on-xterm-mouse-tracking-on-terminal) + (remove-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame) + (remove-hook 'suspend-tty-functions + 'turn-off-xterm-mouse-tracking-on-terminal) + (remove-hook 'resume-tty-functions + 'turn-on-xterm-mouse-tracking-on-terminal) + (remove-hook 'suspend-hook 'turn-off-xterm-mouse-tracking) + (remove-hook 'suspend-resume-hook 'turn-on-xterm-mouse-tracking) + (remove-hook 'kill-emacs-hook 'turn-off-xterm-mouse-tracking) (turn-off-xterm-mouse-tracking 'force) (setq mouse-position-function nil)))