Show
Ignore:
Timestamp:
2007年06月02日 09時29分41秒 (1 year ago)
Author:
miyoshi
Message:

Sync up with Emacs_22_BASE.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/xt-mouse.el

    r4200 r4210  
    123123      c))) 
    124124 
     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 
    125141(defun xterm-mouse-event () 
    126142  "Convert XTerm mouse event to Emacs mouse event." 
     
    130146         ;; Emulate timestamp information.  This is accurate enough 
    131147         ;; for default value of mouse-1-click-follows-link (450msec). 
    132          (timestamp (truncate 
     148         (timestamp (xterm-mouse-truncate-wrap 
    133149                     (* 1000 
    134150                        (- (float-time) 
     
    207223(provide 'xt-mouse) 
    208224 
    209 ;;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03 
     225;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03 
    210226;;; xt-mouse.el ends here