diff options
| author | Stefan Monnier | 2008-03-29 02:15:56 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-03-29 02:15:56 +0000 |
| commit | 146df8458679fd5043ce585655dadf03a5f152b2 (patch) | |
| tree | 634bd47b80c8d73f513eca2d0298e40ff3e13597 | |
| parent | b20ef5aa72c9ac27ac7a1364bce7d79abdaf6334 (diff) | |
| download | emacs-146df8458679fd5043ce585655dadf03a5f152b2.tar.gz emacs-146df8458679fd5043ce585655dadf03a5f152b2.zip | |
(xterm-mouse-mode): Use delete-terminal-functions.
(xterm-mouse-handle-delete-frame): Delete.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/xt-mouse.el | 40 |
2 files changed, 15 insertions, 28 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 972aa057d18..c7dc80a6d65 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2008-03-29 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-03-29 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * xt-mouse.el (xterm-mouse-mode): Use delete-terminal-functions. | ||
| 4 | (xterm-mouse-handle-delete-frame): Delete. | ||
| 5 | |||
| 3 | * term/xterm.el (terminal-init-xterm): Use delete-terminal-functions. | 6 | * term/xterm.el (terminal-init-xterm): Use delete-terminal-functions. |
| 4 | (xterm-turn-on-modify-other-keys, xterm-turn-off-modify-other-keys) | 7 | (xterm-turn-on-modify-other-keys, xterm-turn-off-modify-other-keys) |
| 5 | (xterm-remove-modify-other-keys): Lookup terminal rather than frame | 8 | (xterm-remove-modify-other-keys): Lookup terminal rather than frame |
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 5f8d8ca61db..ea0adc3c8a5 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el | |||
| @@ -205,34 +205,24 @@ single clicks are supported. When turned on, the normal xterm | |||
| 205 | mouse functionality for such clicks is still available by holding | 205 | mouse functionality for such clicks is still available by holding |
| 206 | down the SHIFT key while pressing the mouse button." | 206 | down the SHIFT key while pressing the mouse button." |
| 207 | :global t :group 'mouse | 207 | :global t :group 'mouse |
| 208 | (let ((do-hook (if xterm-mouse-mode 'add-hook 'remove-hook))) | ||
| 209 | (funcall do-hook 'terminal-init-xterm-hook | ||
| 210 | 'turn-on-xterm-mouse-tracking-on-terminal) | ||
| 211 | (funcall do-hook 'delete-terminal-functions | ||
| 212 | 'turn-off-xterm-mouse-tracking-on-terminal) | ||
| 213 | (funcall do-hook 'suspend-tty-functions | ||
| 214 | 'turn-off-xterm-mouse-tracking-on-terminal) | ||
| 215 | (funcall do-hook 'resume-tty-functions | ||
| 216 | 'turn-on-xterm-mouse-tracking-on-terminal) | ||
| 217 | (funcall do-hook 'suspend-hook 'turn-off-xterm-mouse-tracking) | ||
| 218 | (funcall do-hook 'suspend-resume-hook 'turn-on-xterm-mouse-tracking) | ||
| 219 | (funcall do-hook 'kill-emacs-hook 'turn-off-xterm-mouse-tracking)) | ||
| 208 | (if xterm-mouse-mode | 220 | (if xterm-mouse-mode |
| 209 | ;; Turn it on | 221 | ;; Turn it on |
| 210 | (progn | 222 | (progn |
| 211 | ;; Frame creation and deletion. | ||
| 212 | (add-hook 'terminal-init-xterm-hook | ||
| 213 | 'turn-on-xterm-mouse-tracking-on-terminal) | ||
| 214 | |||
| 215 | (add-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame) | ||
| 216 | |||
| 217 | ;; Restore normal mouse behaviour outside Emacs. | ||
| 218 | (add-hook 'suspend-tty-functions | ||
| 219 | 'turn-off-xterm-mouse-tracking-on-terminal) | ||
| 220 | (add-hook 'resume-tty-functions | ||
| 221 | 'turn-on-xterm-mouse-tracking-on-terminal) | ||
| 222 | (add-hook 'suspend-hook 'turn-off-xterm-mouse-tracking) | ||
| 223 | (add-hook 'suspend-resume-hook 'turn-on-xterm-mouse-tracking) | ||
| 224 | (add-hook 'kill-emacs-hook 'turn-off-xterm-mouse-tracking) | ||
| 225 | (setq mouse-position-function #'xterm-mouse-position-function) | 223 | (setq mouse-position-function #'xterm-mouse-position-function) |
| 226 | (turn-on-xterm-mouse-tracking)) | 224 | (turn-on-xterm-mouse-tracking)) |
| 227 | ;; Turn it off | 225 | ;; Turn it off |
| 228 | (remove-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame) | ||
| 229 | (remove-hook 'suspend-tty-functions | ||
| 230 | 'turn-off-xterm-mouse-tracking-on-terminal) | ||
| 231 | (remove-hook 'resume-tty-functions | ||
| 232 | 'turn-on-xterm-mouse-tracking-on-terminal) | ||
| 233 | (remove-hook 'suspend-hook 'turn-off-xterm-mouse-tracking) | ||
| 234 | (remove-hook 'suspend-resume-hook 'turn-on-xterm-mouse-tracking) | ||
| 235 | (remove-hook 'kill-emacs-hook 'turn-off-xterm-mouse-tracking) | ||
| 236 | (turn-off-xterm-mouse-tracking 'force) | 226 | (turn-off-xterm-mouse-tracking 'force) |
| 237 | (setq mouse-position-function nil))) | 227 | (setq mouse-position-function nil))) |
| 238 | 228 | ||
| @@ -269,12 +259,6 @@ down the SHIFT key while pressing the mouse button." | |||
| 269 | ;; pass by untranslated). | 259 | ;; pass by untranslated). |
| 270 | (send-string-to-terminal "\e[?1000l" terminal))) | 260 | (send-string-to-terminal "\e[?1000l" terminal))) |
| 271 | 261 | ||
| 272 | (defun xterm-mouse-handle-delete-frame (frame) | ||
| 273 | "Turn off xterm mouse tracking if FRAME is the last frame on its device." | ||
| 274 | (when (and (eq t (frame-live-p frame)) | ||
| 275 | (<= 1 (length (frames-on-display-list (frame-terminal frame))))) | ||
| 276 | (turn-off-xterm-mouse-tracking-on-terminal frame))) | ||
| 277 | |||
| 278 | (provide 'xt-mouse) | 262 | (provide 'xt-mouse) |
| 279 | 263 | ||
| 280 | ;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03 | 264 | ;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03 |