;;; xt-mouse.el --- support the mouse when emacs run in an xterm
;; Copyright (C) 1994, 2000, 2001, 2002, 2003,
-;; 2004, 2005 Free Software Foundation, Inc.
+;; 2004, 2005, 2006 Free Software Foundation, Inc.
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
;; Keywords: mouse, terminals
;;; Todo:
-;; The xterm mouse escape codes are supposedly also supported by the
-;; Linux console, but I have not been able to verify this.
-
;; Support multi-click -- somehow.
;;; Code:
(set-terminal-parameter nil 'xterm-mouse-x x)
(set-terminal-parameter nil 'xterm-mouse-y y)
- (if w
- (list mouse (posn-at-x-y (- x left) (- y top) w t))
- (list mouse
- (append (list nil 'menu-bar) (nthcdr 2 (posn-at-x-y x y w t)))))))
+ (setq
+ last-input-event
+ (if w
+ (list mouse (posn-at-x-y (- x left) (- y top) w t))
+ (list mouse
+ (append (list nil 'menu-bar) (nthcdr 2 (posn-at-x-y x y w t))))))))
;;;###autoload
(define-minor-mode xterm-mouse-mode
(defun turn-on-xterm-mouse-tracking-on-terminal (terminal)
"Enable xterm mouse tracking on TERMINAL."
- (when (and xterm-mouse-mode (eq t (display-live-p terminal)))
+ (when (and xterm-mouse-mode (eq t (terminal-live-p terminal)))
(send-string-to-terminal "\e[?1000h" terminal)))
(defun turn-off-xterm-mouse-tracking-on-terminal (terminal)
"Disable xterm mouse tracking on TERMINAL."
- (when (and xterm-mouse-mode (eq t (display-live-p terminal)))
+ (when (and xterm-mouse-mode (eq t (terminal-live-p terminal)))
(send-string-to-terminal "\e[?1000l" terminal)))
(defun xterm-mouse-handle-delete-frame (frame)
"Turn off xterm mouse tracking if FRAME is the last frame on its device."
(when (and (eq t (frame-live-p frame))
- (<= 1 (length (frames-on-display-list (frame-display frame)))))
+ (<= 1 (length (frames-on-display-list (frame-terminal frame)))))
(turn-off-xterm-mouse-tracking-on-terminal frame)))
;; Frame creation and deletion.