aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-05-25 15:05:39 +0000
committerStefan Monnier2007-05-25 15:05:39 +0000
commit816718041b1c49a78ed2e6dfeb983283023bb793 (patch)
tree116e367505c1be709bc64a8966c28f5cbe705dcf
parent4b880ac1245e10e1ae80502dd58b174ffceea878 (diff)
downloademacs-816718041b1c49a78ed2e6dfeb983283023bb793.tar.gz
emacs-816718041b1c49a78ed2e6dfeb983283023bb793.zip
(xterm-mouse-truncate-wrap): New function.
(xterm-mouse-event): Use it.
-rw-r--r--lisp/ChangeLog26
-rw-r--r--lisp/xt-mouse.el20
2 files changed, 35 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 93f2477b07f..0e6c3298638 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12007-05-25 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * textmodes/fill.el (canonically-space-region): Make the second arg
4 a marker if it's not already the case.
5
6 * xt-mouse.el (xterm-mouse-truncate-wrap): New function.
7 (xterm-mouse-event): Use it.
8
12007-05-25 Miles Bader <miles@fencepost.gnu.org> 92007-05-25 Miles Bader <miles@fencepost.gnu.org>
2 10
3 * vc-hooks.el (vc-find-root): Fix file attribute test. 11 * vc-hooks.el (vc-find-root): Fix file attribute test.
@@ -46,17 +54,17 @@
46 54
472007-05-18 Rob Riepel <riepel@Stanford.EDU> 552007-05-18 Rob Riepel <riepel@Stanford.EDU>
48 56
49 * emulation/tpu-edt.el (CSI-map, SS3-map) Moved from global-map to 57 * emulation/tpu-edt.el (CSI-map, SS3-map): Move from global-map to
50 tpu-global-map. 58 tpu-global-map.
51 (tpu-original-global-map) Variable deleted. 59 (tpu-original-global-map): Delete variable.
52 (tpu-control-keys-map) New keymap variable. 60 (tpu-control-keys-map): New keymap variable.
53 (tpu-set-control-keys) Use tpu-reset-control-keys rather than 61 (tpu-set-control-keys): Use tpu-reset-control-keys rather than
54 setting keymapping directly. 62 setting keymapping directly.
55 (tpu-reset-control-keys) Use tpu-control-keys-map instead of 63 (tpu-reset-control-keys): Use tpu-control-keys-map instead of
56 tpu-global-map. 64 tpu-global-map.
57 (tpu-edt-on): Activate the tpu-global-map. 65 (tpu-edt-on): Activate the tpu-global-map.
58 (tpu-edt-off): Deactivate the tpu-global-map. 66 (tpu-edt-off): Deactivate the tpu-global-map.
59 67
602007-05-18 Ryan Yeske <rcyeske@gmail.com> 682007-05-18 Ryan Yeske <rcyeske@gmail.com>
61 69
62 * textmodes/ispell.el (ispell-get-word): Return markers 70 * textmodes/ispell.el (ispell-get-word): Return markers
@@ -119,9 +127,9 @@
119 127
1202007-05-14 Eli Zaretskii <eliz@gnu.org> 1282007-05-14 Eli Zaretskii <eliz@gnu.org>
121 129
122 * mail/rmail.el (rmail-convert-to-babyl-format): Check 130 * mail/rmail.el (rmail-convert-to-babyl-format):
123 content-transfer-encoding _last_, because we need its position in 131 Check content-transfer-encoding _last_, because we need its position
124 base64-header-field-end. 132 in base64-header-field-end.
125 133
1262007-05-14 Juanma Barranquero <lekktu@gmail.com> 1342007-05-14 Juanma Barranquero <lekktu@gmail.com>
127 135
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 8ae79903d51..a4779053937 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -122,6 +122,22 @@
122 (+ c #x8000000 128) 122 (+ c #x8000000 128)
123 c))) 123 c)))
124 124
125(defun xterm-mouse-truncate-wrap (f)
126 "Truncate with wrap-around."
127 (condition-case nil
128 ;; First try the built-in truncate, in case there's no overflow.
129 (truncate f)
130 ;; In case of overflow, do wraparound by hand.
131 (range-error
132 ;; In our case, we wrap around every 3 days or so, so if we assume
133 ;; a maximum of 65536 wraparounds, we're safe for a couple years.
134 ;; Using a power of 2 makes rounding errors less likely.
135 (let* ((maxwrap (* 65536 2048))
136 (dbig (truncate (/ f maxwrap)))
137 (fdiff (- f (* 1.0 maxwrap dbig))))
138 (+ (truncate fdiff) (* maxwrap dbig))))))
139
140
125(defun xterm-mouse-event () 141(defun xterm-mouse-event ()
126 "Convert XTerm mouse event to Emacs mouse event." 142 "Convert XTerm mouse event to Emacs mouse event."
127 (let* ((type (- (xterm-mouse-event-read) #o40)) 143 (let* ((type (- (xterm-mouse-event-read) #o40))
@@ -129,7 +145,7 @@
129 (y (- (xterm-mouse-event-read) #o40 1)) 145 (y (- (xterm-mouse-event-read) #o40 1))
130 ;; Emulate timestamp information. This is accurate enough 146 ;; Emulate timestamp information. This is accurate enough
131 ;; for default value of mouse-1-click-follows-link (450msec). 147 ;; for default value of mouse-1-click-follows-link (450msec).
132 (timestamp (truncate 148 (timestamp (xterm-mouse-truncate-wrap
133 (* 1000 149 (* 1000
134 (- (float-time) 150 (- (float-time)
135 (or xt-mouse-epoch 151 (or xt-mouse-epoch
@@ -206,5 +222,5 @@ down the SHIFT key while pressing the mouse button."
206 222
207(provide 'xt-mouse) 223(provide 'xt-mouse)
208 224
209;;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03 225;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03
210;;; xt-mouse.el ends here 226;;; xt-mouse.el ends here