From: Dan Nicolaescu Date: Sat, 15 Sep 2007 00:27:38 +0000 (+0000) Subject: * xt-mouse.el (xterm-mouse-mode): Add hooks here not at the top X-Git-Tag: emacs-pretest-23.0.90~10895 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=aaeefd66c584817a062e0f1f73db23bb0c4744a4;p=emacs.git * 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 --git a/lisp/ChangeLog b/lisp/ChangeLog index 62e9d912c14..b661d0883b6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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 --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 8e803a4534b..de206c159c7 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -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 --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index af7a3789df0..ab07a0c73c9 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -208,9 +208,32 @@ down the SHIFT key while pressing the mouse button." (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)))