(xterm-mouse-truncate-wrap): New function.

(xterm-mouse-event): Use it.
This commit is contained in:
Stefan Monnier 2007-05-25 15:05:39 +00:00
parent 4b880ac124
commit 816718041b
2 changed files with 35 additions and 11 deletions

View file

@ -1,3 +1,11 @@
2007-05-25 Stefan Monnier <monnier@iro.umontreal.ca>
* textmodes/fill.el (canonically-space-region): Make the second arg
a marker if it's not already the case.
* xt-mouse.el (xterm-mouse-truncate-wrap): New function.
(xterm-mouse-event): Use it.
2007-05-25 Miles Bader <miles@fencepost.gnu.org>
* vc-hooks.el (vc-find-root): Fix file attribute test.
@ -46,17 +54,17 @@
2007-05-18 Rob Riepel <riepel@Stanford.EDU>
* emulation/tpu-edt.el (CSI-map, SS3-map) Moved from global-map to
* emulation/tpu-edt.el (CSI-map, SS3-map): Move from global-map to
tpu-global-map.
(tpu-original-global-map) Variable deleted.
(tpu-control-keys-map) New keymap variable.
(tpu-set-control-keys) Use tpu-reset-control-keys rather than
(tpu-original-global-map): Delete variable.
(tpu-control-keys-map): New keymap variable.
(tpu-set-control-keys): Use tpu-reset-control-keys rather than
setting keymapping directly.
(tpu-reset-control-keys) Use tpu-control-keys-map instead of
(tpu-reset-control-keys): Use tpu-control-keys-map instead of
tpu-global-map.
(tpu-edt-on): Activate the tpu-global-map.
(tpu-edt-off): Deactivate the tpu-global-map.
2007-05-18 Ryan Yeske <rcyeske@gmail.com>
* textmodes/ispell.el (ispell-get-word): Return markers
@ -119,9 +127,9 @@
2007-05-14 Eli Zaretskii <eliz@gnu.org>
* mail/rmail.el (rmail-convert-to-babyl-format): Check
content-transfer-encoding _last_, because we need its position in
base64-header-field-end.
* mail/rmail.el (rmail-convert-to-babyl-format):
Check content-transfer-encoding _last_, because we need its position
in base64-header-field-end.
2007-05-14 Juanma Barranquero <lekktu@gmail.com>

View file

@ -122,6 +122,22 @@
(+ c #x8000000 128)
c)))
(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))))))
(defun xterm-mouse-event ()
"Convert XTerm mouse event to Emacs mouse event."
(let* ((type (- (xterm-mouse-event-read) #o40))
@ -129,7 +145,7 @@
(y (- (xterm-mouse-event-read) #o40 1))
;; Emulate timestamp information. This is accurate enough
;; for default value of mouse-1-click-follows-link (450msec).
(timestamp (truncate
(timestamp (xterm-mouse-truncate-wrap
(* 1000
(- (float-time)
(or xt-mouse-epoch
@ -206,5 +222,5 @@ down the SHIFT key while pressing the mouse button."
(provide 'xt-mouse)
;;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03
;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03
;;; xt-mouse.el ends here