aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2005-02-22 09:42:06 +0000
committerKim F. Storm2005-02-22 09:42:06 +0000
commitb0ca1b8a9689a39682d221cff2fef26a7adf33b9 (patch)
tree9c276de421b77c162774538bc56dc751d6d70e67
parentbaf70a025c29e4405cb608c5413e4d966afd7d6c (diff)
downloademacs-b0ca1b8a9689a39682d221cff2fef26a7adf33b9.tar.gz
emacs-b0ca1b8a9689a39682d221cff2fef26a7adf33b9.zip
(mouse-on-link-p): If arg POS is a mouse event,
check that window of that event is the selected window. (mouse-drag-region-1): Compare mouse event window to selected window before setting point.
-rw-r--r--lisp/mouse.el37
1 files changed, 23 insertions, 14 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 96c1b85f98b..5efcca1bd5e 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -769,6 +769,8 @@ If the click is in the echo area, display the `*Messages*' buffer."
769 769
770(defun mouse-on-link-p (pos) 770(defun mouse-on-link-p (pos)
771 "Return non-nil if POS is on a link in the current buffer. 771 "Return non-nil if POS is on a link in the current buffer.
772POS must be a buffer position in the current buffer or an mouse
773event location in the selected window, see `event-start'.
772 774
773A clickable link is identified by one of the following methods: 775A clickable link is identified by one of the following methods:
774 776
@@ -787,7 +789,7 @@ is a non-nil `mouse-face' property at POS. Return t in this case.
787 789
788- If the value is a function, FUNC, POS is inside a link if 790- If the value is a function, FUNC, POS is inside a link if
789the call \(FUNC POS) returns non-nil. Return the return value 791the call \(FUNC POS) returns non-nil. Return the return value
790from that call. 792from that call. Arg is \(posn-point POS) if POS is a mouse event,
791 793
792- Otherwise, return the value itself. 794- Otherwise, return the value itself.
793 795
@@ -803,17 +805,22 @@ click is the local or global binding of that event.
803 805
804- Otherwise, the mouse-1 event is translated into a mouse-2 event 806- Otherwise, the mouse-1 event is translated into a mouse-2 event
805at the same position." 807at the same position."
806 (let ((action 808 (if (consp pos)
807 (or (get-char-property pos 'follow-link) 809 (setq pos (and (eq (selected-window) (posn-window pos))
808 (save-excursion 810 (posn-point pos))))
809 (goto-char pos) 811 (when pos
810 (key-binding [follow-link] nil t))))) 812 (let ((action
811 (cond 813 (or (get-char-property pos 'follow-link)
812 ((eq action 'mouse-face) 814 (save-excursion
813 (and (get-char-property pos 'mouse-face) t)) 815 (goto-char pos)
814 ((functionp action) 816 (key-binding [follow-link] nil t)))))
815 (funcall action pos)) 817 (cond
816 (t action)))) 818 ((eq action 'mouse-face)
819 (and (get-char-property pos 'mouse-face) t))
820 ((functionp action)
821 (funcall action pos))
822 (t action)))))
823
817 824
818(defun mouse-drag-region-1 (start-event) 825(defun mouse-drag-region-1 (start-event)
819 (mouse-minibuffer-check start-event) 826 (mouse-minibuffer-check start-event)
@@ -831,7 +838,9 @@ at the same position."
831 (nth 3 bounds) 838 (nth 3 bounds)
832 ;; Don't count the mode line. 839 ;; Don't count the mode line.
833 (1- (nth 3 bounds)))) 840 (1- (nth 3 bounds))))
834 on-link remap-double-click 841 (on-link (and mouse-1-click-follows-link
842 (eq start-window (selected-window))))
843 remap-double-click
835 (click-count (1- (event-click-count start-event)))) 844 (click-count (1- (event-click-count start-event))))
836 (setq mouse-selection-click-count click-count) 845 (setq mouse-selection-click-count click-count)
837 (setq mouse-selection-click-count-buffer (current-buffer)) 846 (setq mouse-selection-click-count-buffer (current-buffer))
@@ -841,7 +850,7 @@ at the same position."
841 (if (< (point) start-point) 850 (if (< (point) start-point)
842 (goto-char start-point)) 851 (goto-char start-point))
843 (setq start-point (point)) 852 (setq start-point (point))
844 (setq on-link (and mouse-1-click-follows-link 853 (setq on-link (and on-link
845 (mouse-on-link-p start-point))) 854 (mouse-on-link-p start-point)))
846 (setq remap-double-click (and on-link 855 (setq remap-double-click (and on-link
847 (eq mouse-1-click-follows-link 'double) 856 (eq mouse-1-click-follows-link 'double)