]> git.eshelyaron.com Git - emacs.git/commitdiff
(xterm-mouse-event): Recognize control sequences
authorGerd Moellmann <gerd@gnu.org>
Wed, 25 Jul 2001 17:42:56 +0000 (17:42 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 25 Jul 2001 17:42:56 +0000 (17:42 +0000)
for buttons > 3.
(xterm-mouse-translate): Handle the case that we don't get a
down-event.

lisp/ChangeLog
lisp/xt-mouse.el

index e64d0948673de0c48c426cf21c535456a300ac7d..b2c6a88138c90e768ff1141c1cd8aaede6b62812 100644 (file)
@@ -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.
index 863a3c9189d1fedd2c9302f0eaf20b6af53ceabc..061830fa5c673ad1046b3fabe0ca67f94ff2ad72 100644 (file)
@@ -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
             (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)))
 
 (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
                                       (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