Mercurial > emacs
comparison lisp/t-mouse.el @ 80848:03a94cbf631a
(t-mouse-mode): Do nothing on a graphical display
when disabling t-mouse-mode.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Fri, 04 May 2007 02:26:14 +0000 |
parents | 8172a170a5d7 |
children | ce6c8b83a99a |
comparison
equal
deleted
inserted
replaced
80847:b087ba5edba9 | 80848:03a94cbf631a |
---|---|
273 "Toggle t-mouse mode. | 273 "Toggle t-mouse mode. |
274 With prefix arg, turn t-mouse mode on iff arg is positive. | 274 With prefix arg, turn t-mouse mode on iff arg is positive. |
275 | 275 |
276 Turn it on to use Emacs mouse commands, and off to use t-mouse commands." | 276 Turn it on to use Emacs mouse commands, and off to use t-mouse commands." |
277 nil " Mouse" nil :global t | 277 nil " Mouse" nil :global t |
278 (if t-mouse-mode | 278 (unless window-system |
279 ;; Turn it on | 279 (if t-mouse-mode |
280 (unless window-system | 280 ;; Turn it on. Starts getting a stream of mouse events from an |
281 ;; Starts getting a stream of mouse events from an asynchronous process. | 281 ;; asynchronous process. Only works if Emacs is running on a virtual |
282 ;; Only works if Emacs is running on a virtual terminal without a window system. | 282 ;; terminal without a window system. |
283 (progn | 283 (progn |
284 (setq mouse-position-function #'t-mouse-mouse-position-function) | 284 (setq mouse-position-function #'t-mouse-mouse-position-function) |
285 (let ((tty (t-mouse-tty)) | 285 (let ((tty (t-mouse-tty)) |
286 (process-connection-type t)) | 286 (process-connection-type t)) |
287 (if (not (stringp tty)) | 287 (if (not (stringp tty)) |
288 (error "Cannot find a virtual terminal")) | 288 (error "Cannot find a virtual terminal")) |
289 (setq t-mouse-process | 289 (setq t-mouse-process |
290 (start-process "t-mouse" nil | 290 (start-process "t-mouse" nil |
291 "mev" "-i" "-E" "-C" tty | 291 "mev" "-i" "-E" "-C" tty |
292 (if t-mouse-swap-alt-keys | 292 (if t-mouse-swap-alt-keys |
293 "-M-leftAlt" "-M-rightAlt") | 293 "-M-leftAlt" "-M-rightAlt") |
294 "-e-move" | 294 "-e-move" |
295 "-dall" "-d-hard" | 295 "-dall" "-d-hard" |
296 "-f"))) | 296 "-f"))) |
297 (setq t-mouse-filter-accumulator "") | 297 (setq t-mouse-filter-accumulator "") |
298 (set-process-filter t-mouse-process 't-mouse-process-filter) | 298 (set-process-filter t-mouse-process 't-mouse-process-filter) |
299 (set-process-query-on-exit-flag t-mouse-process nil))) | 299 (set-process-query-on-exit-flag t-mouse-process nil)) |
300 ;; Turn it off | 300 ;; Turn it off |
301 (setq mouse-position-function nil) | 301 (setq mouse-position-function nil) |
302 (delete-process t-mouse-process) | 302 (delete-process t-mouse-process) |
303 (setq t-mouse-process nil))) | 303 (setq t-mouse-process nil)))) |
304 | 304 |
305 (provide 't-mouse) | 305 (provide 't-mouse) |
306 | 306 |
307 ;; arch-tag: a63163b3-bfbe-4eb2-ab4f-201cd164b05d | 307 ;; arch-tag: a63163b3-bfbe-4eb2-ab4f-201cd164b05d |
308 ;;; t-mouse.el ends here | 308 ;;; t-mouse.el ends here |