]> git.eshelyaron.com Git - emacs.git/commitdiff
* xt-mouse.el (xterm-mouse-mode): Add hooks here not at the top
authorDan Nicolaescu <dann@ics.uci.edu>
Sat, 15 Sep 2007 00:27:38 +0000 (00:27 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Sat, 15 Sep 2007 00:27:38 +0000 (00:27 +0000)
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.

lisp/ChangeLog
lisp/term/xterm.el
lisp/xt-mouse.el

index 62e9d912c14f094f2fd4519a25893e9b27c3ce0c..b661d0883b678abb1efbbc053c6040580fb67e91 100644 (file)
@@ -1,3 +1,12 @@
+2007-09-15  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * 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  <dann@ics.uci.edu>
 
        * term/xterm.el (xterm-function-map): Replace bindings that were
index 8e803a4534bce6f0ec2ca2cd5adee2a4a4cb7b3e..de206c159c7aed6137752f7b6a301c079bd14835 100644 (file)
@@ -27,6 +27,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'xt-mouse))
+
 (defvar xterm-function-map
   (let ((map (make-sparse-keymap)))
 
     (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.
index af7a3789df0488e9daac45d6483253a73b6b6bc3..ab07a0c73c99715786592bbeb5a3734b26d77bbf 100644 (file)
@@ -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)))