diff options
author | Gerd Moellmann <gerd@gnu.org> | 2001-07-25 17:42:56 +0000 |
---|---|---|
committer | Gerd Moellmann <gerd@gnu.org> | 2001-07-25 17:42:56 +0000 |
commit | 4b09e331fabd943d4fefb61dfe57a73cf9932b0d (patch) | |
tree | ef053bc08c0b0effbd2f1d53d57f473470638ed4 | |
parent | f37e8c7718ba3b03a8f2cba59b7f9b36347b1c47 (diff) | |
download | emacs-4b09e331fabd943d4fefb61dfe57a73cf9932b0d.tar.gz |
(xterm-mouse-event): Recognize control sequences
for buttons > 3.
(xterm-mouse-translate): Handle the case that we don't get a
down-event.
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/xt-mouse.el | 40 |
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 @@ 2001-07-25 Gerd Moellmann <gerd@gnu.org> + * xt-mouse.el (xterm-mouse-event): Recognize control sequences + for buttons > 3. + (xterm-mouse-translate): Handle the case that we don't get a + down-event. + * emacs-lisp/find-func.el (find-function-regexp): Add easy-mmode-define-global-mode to the regexp. Allow newlines 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 @@ ;;; xt-mouse.el --- support the mouse when emacs run in an xterm -;; Copyright (C) 1994, 2000 Free Software Foundation +;; Copyright (C) 1994, 2000, 2001 Free Software Foundation ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> ;; Keywords: mouse, terminals @@ -63,12 +63,16 @@ (down-where (nth 1 down-data)) (down-binding (key-binding (if (symbolp down-where) (vector down-where down-command) - (vector down-command))))) - (or (and (eq (read-char) ?\e) - (eq (read-char) ?\[) - (eq (read-char) ?M)) - (error "Unexpected escape sequence from XTerm")) - (let* ((click (xterm-mouse-event)) + (vector down-command)))) + (is-click (string-match "^mouse" (symbol-name (car down))))) + + (unless is-click + (unless (and (eq (read-char) ?\e) + (eq (read-char) ?\[) + (eq (read-char) ?M)) + (error "Unexpected escape sequence from XTerm"))) + + (let* ((click (if is-click down (xterm-mouse-event))) (click-command (nth 0 click)) (click-data (nth 1 click)) (click-where (nth 1 click-data))) @@ -111,9 +115,9 @@ (defun xterm-mouse-event () "Convert XTerm mouse event to Emacs mouse event." - (let* ((type (- (read-char) ? )) - (x (- (read-char) ? 1)) - (y (- (read-char) ? 1)) + (let* ((type (- (read-char) #o40)) + (x (- (read-char) #o40 1)) + (y (- (read-char) #o40 1)) (point (cons x y)) (window (window-at x y)) (where (if window @@ -137,10 +141,18 @@ (max 0 (1- (window-hscroll))))) (point)) where)) - (mouse (intern (if (eq type 3) - (format "mouse-%d" (+ 1 xterm-mouse-last)) - (setq xterm-mouse-last type) - (format "down-mouse-%d" (+ 1 type)))))) + (mouse (intern + ;; For buttons > 3, the release-event looks + ;; differently (see xc/programs/xterm/button.c, + ;; function EditorButton), and there seems to come in + ;; a release-event only, no down-event. + (cond ((>= type 64) + (format "mouse-%d" (- type 60))) + ((= type 3) + (format "mouse-%d" (+ 1 xterm-mouse-last))) + (t + (setq xterm-mouse-last type) + (format "down-mouse-%d" (+ 1 type))))))) (setq xterm-mouse-x x xterm-mouse-y y) (list mouse |