aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/xt-mouse.el40
2 files changed, 31 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e64d0948673..b2c6a88138c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -7,6 +7,11 @@
7 7
82001-07-25 Gerd Moellmann <gerd@gnu.org> 82001-07-25 Gerd Moellmann <gerd@gnu.org>
9 9
10 * xt-mouse.el (xterm-mouse-event): Recognize control sequences
11 for buttons > 3.
12 (xterm-mouse-translate): Handle the case that we don't get a
13 down-event.
14
10 * emacs-lisp/find-func.el (find-function-regexp): Add 15 * emacs-lisp/find-func.el (find-function-regexp): Add
11 easy-mmode-define-global-mode to the regexp. Allow newlines 16 easy-mmode-define-global-mode to the regexp. Allow newlines
12 in front of the function name. 17 in front of the function name.
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 863a3c9189d..061830fa5c6 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -1,6 +1,6 @@
1;;; xt-mouse.el --- support the mouse when emacs run in an xterm 1;;; xt-mouse.el --- support the mouse when emacs run in an xterm
2 2
3;; Copyright (C) 1994, 2000 Free Software Foundation 3;; Copyright (C) 1994, 2000, 2001 Free Software Foundation
4 4
5;; Author: Per Abrahamsen <abraham@dina.kvl.dk> 5;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6;; Keywords: mouse, terminals 6;; Keywords: mouse, terminals
@@ -63,12 +63,16 @@
63 (down-where (nth 1 down-data)) 63 (down-where (nth 1 down-data))
64 (down-binding (key-binding (if (symbolp down-where) 64 (down-binding (key-binding (if (symbolp down-where)
65 (vector down-where down-command) 65 (vector down-where down-command)
66 (vector down-command))))) 66 (vector down-command))))
67 (or (and (eq (read-char) ?\e) 67 (is-click (string-match "^mouse" (symbol-name (car down)))))
68 (eq (read-char) ?\[) 68
69 (eq (read-char) ?M)) 69 (unless is-click
70 (error "Unexpected escape sequence from XTerm")) 70 (unless (and (eq (read-char) ?\e)
71 (let* ((click (xterm-mouse-event)) 71 (eq (read-char) ?\[)
72 (eq (read-char) ?M))
73 (error "Unexpected escape sequence from XTerm")))
74
75 (let* ((click (if is-click down (xterm-mouse-event)))
72 (click-command (nth 0 click)) 76 (click-command (nth 0 click))
73 (click-data (nth 1 click)) 77 (click-data (nth 1 click))
74 (click-where (nth 1 click-data))) 78 (click-where (nth 1 click-data)))
@@ -111,9 +115,9 @@
111 115
112(defun xterm-mouse-event () 116(defun xterm-mouse-event ()
113 "Convert XTerm mouse event to Emacs mouse event." 117 "Convert XTerm mouse event to Emacs mouse event."
114 (let* ((type (- (read-char) ? )) 118 (let* ((type (- (read-char) #o40))
115 (x (- (read-char) ? 1)) 119 (x (- (read-char) #o40 1))
116 (y (- (read-char) ? 1)) 120 (y (- (read-char) #o40 1))
117 (point (cons x y)) 121 (point (cons x y))
118 (window (window-at x y)) 122 (window (window-at x y))
119 (where (if window 123 (where (if window
@@ -137,10 +141,18 @@
137 (max 0 (1- (window-hscroll))))) 141 (max 0 (1- (window-hscroll)))))
138 (point)) 142 (point))
139 where)) 143 where))
140 (mouse (intern (if (eq type 3) 144 (mouse (intern
141 (format "mouse-%d" (+ 1 xterm-mouse-last)) 145 ;; For buttons > 3, the release-event looks
142 (setq xterm-mouse-last type) 146 ;; differently (see xc/programs/xterm/button.c,
143 (format "down-mouse-%d" (+ 1 type)))))) 147 ;; function EditorButton), and there seems to come in
148 ;; a release-event only, no down-event.
149 (cond ((>= type 64)
150 (format "mouse-%d" (- type 60)))
151 ((= type 3)
152 (format "mouse-%d" (+ 1 xterm-mouse-last)))
153 (t
154 (setq xterm-mouse-last type)
155 (format "down-mouse-%d" (+ 1 type)))))))
144 (setq xterm-mouse-x x 156 (setq xterm-mouse-x x
145 xterm-mouse-y y) 157 xterm-mouse-y y)
146 (list mouse 158 (list mouse