Mercurial > hg > xemacs-beta
comparison lisp/mouse.el @ 255:084402c475ba r20-5b26
Import from CVS: tag r20-5b26
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:21:18 +0200 |
parents | 83b3d10dcba9 |
children | c5d627a313b1 |
comparison
equal
deleted
inserted
replaced
254:e92abcaa252b | 255:084402c475ba |
---|---|
743 (defvar default-mouse-track-min-anchor nil) | 743 (defvar default-mouse-track-min-anchor nil) |
744 (defvar default-mouse-track-max-anchor nil) | 744 (defvar default-mouse-track-max-anchor nil) |
745 (defvar default-mouse-track-result nil) | 745 (defvar default-mouse-track-result nil) |
746 (defvar default-mouse-track-down-event nil) | 746 (defvar default-mouse-track-down-event nil) |
747 | 747 |
748 ;; D. Verna Feb. 17 1998 | |
749 ;; This function used to assume that when (event-window event) differs from | |
750 ;; window, we have to scroll. This is WRONG, for instance when there are | |
751 ;; toolbars on the side, in which case window-event returns nil. | |
748 (defun default-mouse-track-set-point-in-window (event window) | 752 (defun default-mouse-track-set-point-in-window (event window) |
749 (if (not (and (not (event-over-modeline-p event)) | 753 (if (event-over-modeline-p event) |
750 (eq (event-window event) window) | 754 nil ;; Scroll |
751 (let ((p (event-closest-point event))) | 755 ;; Not over a modeline |
752 (and p (pos-visible-in-window-p p window))))) | 756 (if (eq (event-window event) window) |
753 nil | 757 (let ((p (event-closest-point event))) |
754 (mouse-set-point event) | 758 (if (or (not p) (not (pos-visible-in-window-p p window))) |
755 t)) | 759 nil ;; Scroll |
760 (mouse-set-point event) | |
761 t)) | |
762 ;; Not over a modeline, not the same window. Check if the Y position | |
763 ;; is still overlapping the original window. | |
764 (let* ((edges (window-pixel-edges window)) | |
765 (row (event-y-pixel event)) | |
766 (text-start (nth 1 edges)) | |
767 (text-end (+ (nth 3 edges)))) | |
768 (if (or (< row text-start) | |
769 (> row text-end)) | |
770 nil ;; Scroll | |
771 ;; The Y pos in overlapping the original window. Check however if | |
772 ;; the position is really visible, because there could be a | |
773 ;; scrollbar or a modeline at this place. | |
774 ;; Find the mean line height (height / lines nb), and approximate | |
775 ;; the line number for Y pos. | |
776 (select-window window) | |
777 (let ((line (/ (* (- row text-start) (window-height)) | |
778 (- text-end text-start)))) | |
779 (if (not (save-excursion | |
780 (goto-char (window-start)) | |
781 (pos-visible-in-window-p | |
782 (point-at-bol (+ 1 line))))) | |
783 nil ;; Scroll | |
784 ;; OK, we can go to that position | |
785 (goto-char (window-start)) | |
786 (forward-line line) | |
787 ;; On the right side: go to end-of-line. | |
788 (when (>= (event-x-pixel event) (nth 2 edges)) | |
789 (goto-char (point-at-eol))) | |
790 t)))) | |
791 ))) | |
792 | |
756 | 793 |
757 (defun default-mouse-track-scroll-and-set-point (event window) | 794 (defun default-mouse-track-scroll-and-set-point (event window) |
758 (select-window window) | 795 (select-window window) |
759 (let ((edges (window-pixel-edges window)) | 796 (let ((edges (window-pixel-edges window)) |
760 (row (event-y-pixel event)) | 797 (row (event-y-pixel event)) |