comparison jde-hax.el @ 7:5f3a215f12eb

*** empty log message ***
author ht
date Mon, 29 Aug 2005 08:51:09 +0100
parents
children
comparison
equal deleted inserted replaced
6:dccf9e53f179 7:5f3a215f12eb
1 (defun jde-cursor-posn-as-event(&optional forceText)
2 "Returns the text cursor position as an EVENT on Emacs and the mouse
3 cursor position on XEmacs."
4 (if (and jde-xemacsp (not forceText))
5 (let* ((mouse-pos (mouse-pixel-position))
6 (x (car (cdr mouse-pos)))
7 (y (cdr (cdr mouse-pos))))
8 (if x
9 (make-event 'button-press `(button 1 modifiers nil x ,x y ,y))
10 (let ((fake (jde-cursor-posn-as-event t)))
11 (make-event 'button-press `(button 1 modifiers nil
12 x ,(caar fake)
13 y ,(cadar fake))))))
14 (let ((x (* (if jde-xemacsp (/(window-pixel-width)(window-width))
15 (frame-char-width))
16 (if (and
17 (boundp 'hscroll-mode)
18 (fboundp 'hscroll-window-column))
19 (hscroll-window-column)
20 (mod (current-column) (window-width)))))
21 (y (* (if jde-xemacsp (/ (window-pixel-height)
22 (window-height))
23 (frame-char-height))
24 (- (count-lines (point-min) (point))
25 (count-lines (point-min) (window-start)))))
26 (window (get-buffer-window (current-buffer))))
27 (list (list x y) window))))