aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-02-12 15:20:40 -0800
committerPaul Eggert2019-02-12 15:21:11 -0800
commite05ea0ea3117aa0ddd963585d5647fe116b8ffa0 (patch)
tree42fb4dae5ed29f92746d8967fc0d2626847cc1c2
parent5abaf16ab49b86ca5add981c2ddcaea6db0c8a08 (diff)
downloademacs-e05ea0ea3117aa0ddd963585d5647fe116b8ffa0.tar.gz
emacs-e05ea0ea3117aa0ddd963585d5647fe116b8ffa0.zip
Make xterm-mouse-truncate-wrap obsolete
* lisp/xt-mouse.el (xterm-mouse-truncate-wrap): Now obsolete, since we no longer need to worry about integer overflow. (xterm-mouse-event): Use plain ‘truncate’ instead.
-rw-r--r--lisp/xt-mouse.el21
1 files changed, 4 insertions, 17 deletions
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index fc00d1d99a3..770aecfcbef 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -123,20 +123,7 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
123 (terminal-parameter nil 'xterm-mouse-y)))) 123 (terminal-parameter nil 'xterm-mouse-y))))
124 pos) 124 pos)
125 125
126(defun xterm-mouse-truncate-wrap (f) 126(define-obsolete-function-alias 'xterm-mouse-truncate-wrap 'truncate "27.1")
127 "Truncate with wrap-around."
128 (condition-case nil
129 ;; First try the built-in truncate, in case there's no overflow.
130 (truncate f)
131 ;; In case of overflow, do wraparound by hand.
132 (range-error
133 ;; In our case, we wrap around every 3 days or so, so if we assume
134 ;; a maximum of 65536 wraparounds, we're safe for a couple years.
135 ;; Using a power of 2 makes rounding errors less likely.
136 (let* ((maxwrap (* 65536 2048))
137 (dbig (truncate (/ f maxwrap)))
138 (fdiff (- f (* 1.0 maxwrap dbig))))
139 (+ (truncate fdiff) (* maxwrap dbig))))))
140 127
141(defcustom xterm-mouse-utf-8 nil 128(defcustom xterm-mouse-utf-8 nil
142 "Non-nil if UTF-8 coordinates should be used to read mouse coordinates. 129 "Non-nil if UTF-8 coordinates should be used to read mouse coordinates.
@@ -256,7 +243,7 @@ which is the \"1006\" extension implemented in Xterm >= 277."
256 (y (nth 2 click)) 243 (y (nth 2 click))
257 ;; Emulate timestamp information. This is accurate enough 244 ;; Emulate timestamp information. This is accurate enough
258 ;; for default value of mouse-1-click-follows-link (450msec). 245 ;; for default value of mouse-1-click-follows-link (450msec).
259 (timestamp (xterm-mouse-truncate-wrap 246 (timestamp (truncate
260 (* 1000 247 (* 1000
261 (- (float-time) 248 (- (float-time)
262 (or xt-mouse-epoch 249 (or xt-mouse-epoch
@@ -266,8 +253,8 @@ which is the \"1006\" extension implemented in Xterm >= 277."
266 (left (nth 0 ltrb)) 253 (left (nth 0 ltrb))
267 (top (nth 1 ltrb)) 254 (top (nth 1 ltrb))
268 (posn (if w 255 (posn (if w
269 (posn-at-x-y (- x left) (- y top) w t) 256 (posn-at-x-y (- x left) (- y top) w t)
270 (append (list nil 'menu-bar) 257 (append (list nil 'menu-bar)
271 (nthcdr 2 (posn-at-x-y x y))))) 258 (nthcdr 2 (posn-at-x-y x y)))))
272 (event (list type posn))) 259 (event (list type posn)))
273 (setcar (nthcdr 3 posn) timestamp) 260 (setcar (nthcdr 3 posn) timestamp)