summaryrefslogtreecommitdiff
path: root/lisp/xt-mouse.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/xt-mouse.el')
-rw-r--r--lisp/xt-mouse.el31
1 files changed, 7 insertions, 24 deletions
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index cfa9c36ea0e..5ff718292d3 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -123,20 +123,7 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
(terminal-parameter nil 'xterm-mouse-y))))
pos)
-(defun xterm-mouse-truncate-wrap (f)
- "Truncate with wrap-around."
- (condition-case nil
- ;; First try the built-in truncate, in case there's no overflow.
- (truncate f)
- ;; In case of overflow, do wraparound by hand.
- (range-error
- ;; In our case, we wrap around every 3 days or so, so if we assume
- ;; a maximum of 65536 wraparounds, we're safe for a couple years.
- ;; Using a power of 2 makes rounding errors less likely.
- (let* ((maxwrap (* 65536 2048))
- (dbig (truncate (/ f maxwrap)))
- (fdiff (- f (* 1.0 maxwrap dbig))))
- (+ (truncate fdiff) (* maxwrap dbig))))))
+(define-obsolete-function-alias 'xterm-mouse-truncate-wrap 'truncate "27.1")
(defcustom xterm-mouse-utf-8 nil
"Non-nil if UTF-8 coordinates should be used to read mouse coordinates.
@@ -256,18 +243,17 @@ which is the \"1006\" extension implemented in Xterm >= 277."
(y (nth 2 click))
;; Emulate timestamp information. This is accurate enough
;; for default value of mouse-1-click-follows-link (450msec).
- (timestamp (xterm-mouse-truncate-wrap
- (* 1000
- (- (float-time)
- (or xt-mouse-epoch
- (setq xt-mouse-epoch (float-time)))))))
+ (timestamp (if (not xt-mouse-epoch)
+ (progn (setq xt-mouse-epoch (float-time)) 0)
+ (car (encode-time (time-since xt-mouse-epoch)
+ 1000))))
(w (window-at x y))
(ltrb (window-edges w))
(left (nth 0 ltrb))
(top (nth 1 ltrb))
(posn (if w
- (posn-at-x-y (- x left) (- y top) w t)
- (append (list nil 'menu-bar)
+ (posn-at-x-y (- x left) (- y top) w t)
+ (append (list nil 'menu-bar)
(nthcdr 2 (posn-at-x-y x y)))))
(event (list type posn)))
(setcar (nthcdr 3 posn) timestamp)
@@ -312,9 +298,6 @@ which is the \"1006\" extension implemented in Xterm >= 277."
;;;###autoload
(define-minor-mode xterm-mouse-mode
"Toggle XTerm mouse mode.
-With a prefix argument ARG, enable XTerm mouse mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil.
Turn it on to use Emacs mouse commands, and off to use xterm mouse commands.
This works in terminal emulators compatible with xterm. It only