# HG changeset patch # User Kim F. Storm # Date 1109065326 0 # Node ID 074d6632232c99975f5cad6d368a0ae250e8c3ea # Parent ba4a03ed6f89049b805977e7d78653cf4016bf21 (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. diff -r ba4a03ed6f89 -r 074d6632232c lisp/mouse.el --- a/lisp/mouse.el Tue Feb 22 09:41:50 2005 +0000 +++ b/lisp/mouse.el Tue Feb 22 09:42:06 2005 +0000 @@ -769,6 +769,8 @@ (defun mouse-on-link-p (pos) "Return non-nil if POS is on a link in the current buffer. +POS must be a buffer position in the current buffer or an mouse +event location in the selected window, see `event-start'. A clickable link is identified by one of the following methods: @@ -787,7 +789,7 @@ - If the value is a function, FUNC, POS is inside a link if the call \(FUNC POS) returns non-nil. Return the return value -from that call. +from that call. Arg is \(posn-point POS) if POS is a mouse event, - Otherwise, return the value itself. @@ -803,17 +805,22 @@ - Otherwise, the mouse-1 event is translated into a mouse-2 event at the same position." - (let ((action - (or (get-char-property pos 'follow-link) - (save-excursion - (goto-char pos) - (key-binding [follow-link] nil t))))) - (cond - ((eq action 'mouse-face) - (and (get-char-property pos 'mouse-face) t)) - ((functionp action) - (funcall action pos)) - (t action)))) + (if (consp pos) + (setq pos (and (eq (selected-window) (posn-window pos)) + (posn-point pos)))) + (when pos + (let ((action + (or (get-char-property pos 'follow-link) + (save-excursion + (goto-char pos) + (key-binding [follow-link] nil t))))) + (cond + ((eq action 'mouse-face) + (and (get-char-property pos 'mouse-face) t)) + ((functionp action) + (funcall action pos)) + (t action))))) + (defun mouse-drag-region-1 (start-event) (mouse-minibuffer-check start-event) @@ -831,7 +838,9 @@ (nth 3 bounds) ;; Don't count the mode line. (1- (nth 3 bounds)))) - on-link remap-double-click + (on-link (and mouse-1-click-follows-link + (eq start-window (selected-window)))) + remap-double-click (click-count (1- (event-click-count start-event)))) (setq mouse-selection-click-count click-count) (setq mouse-selection-click-count-buffer (current-buffer)) @@ -841,7 +850,7 @@ (if (< (point) start-point) (goto-char start-point)) (setq start-point (point)) - (setq on-link (and mouse-1-click-follows-link + (setq on-link (and on-link (mouse-on-link-p start-point))) (setq remap-double-click (and on-link (eq mouse-1-click-follows-link 'double)