summaryrefslogtreecommitdiff
path: root/lisp/xt-mouse.el
diff options
context:
space:
mode:
authorDan Nicolaescu <dann@ics.uci.edu>2007-09-15 00:27:38 +0000
committerDan Nicolaescu <dann@ics.uci.edu>2007-09-15 00:27:38 +0000
commitaaeefd66c584817a062e0f1f73db23bb0c4744a4 (patch)
tree8d3cbcabf19229b28b1593f588312db4161f8699 /lisp/xt-mouse.el
parentda600aad2b78301836086568c4cb16a907ccf00e (diff)
downloademacs-aaeefd66c584817a062e0f1f73db23bb0c4744a4.tar.gz
* 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.
Diffstat (limited to 'lisp/xt-mouse.el')
-rw-r--r--lisp/xt-mouse.el23
1 files changed, 23 insertions, 0 deletions
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)))