summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2005-12-28 03:19:29 +0000
committerRichard M. Stallman <rms@gnu.org>2005-12-28 03:19:29 +0000
commit18e980c2ae616c850f2786bd889c26b0eab71ff3 (patch)
treefcebd5961fb41a9fea9149bce536d5e351a20101 /lisp/mouse.el
parent1d69c502649e3444975791b4553fbe537cd4c0cc (diff)
downloademacs-18e980c2ae616c850f2786bd889c26b0eab71ff3.tar.gz
(mouse-drag-region-1): When remapping mouse-1 to mouse-2, go back to
previously selected window, so it's selected when mouse-2 command runs.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el43
1 files changed, 24 insertions, 19 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index b92413f7383..186fa438b35 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1002,25 +1002,30 @@ at the same position."
(or end-point
(= (window-start start-window)
start-window-start)))
- (if (and on-link
- (or (not end-point) (= end-point start-point))
- (consp event)
- (or remap-double-click
- (and
- (not (eq mouse-1-click-follows-link 'double))
- (= click-count 0)
- (= (event-click-count event) 1)
- (not (input-pending-p))
- (or (not (integerp mouse-1-click-follows-link))
- (let ((t0 (posn-timestamp (event-start start-event)))
- (t1 (posn-timestamp (event-end event))))
- (and (integerp t0) (integerp t1)
- (if (> mouse-1-click-follows-link 0)
- (<= (- t1 t0) mouse-1-click-follows-link)
- (< (- t0 t1) mouse-1-click-follows-link))))))))
- (if (or (vectorp on-link) (stringp on-link))
- (setq event (aref on-link 0))
- (setcar event 'mouse-2)))
+ (when (and on-link
+ (or (not end-point) (= end-point start-point))
+ (consp event)
+ (or remap-double-click
+ (and
+ (not (eq mouse-1-click-follows-link 'double))
+ (= click-count 0)
+ (= (event-click-count event) 1)
+ (not (input-pending-p))
+ (or (not (integerp mouse-1-click-follows-link))
+ (let ((t0 (posn-timestamp (event-start start-event)))
+ (t1 (posn-timestamp (event-end event))))
+ (and (integerp t0) (integerp t1)
+ (if (> mouse-1-click-follows-link 0)
+ (<= (- t1 t0) mouse-1-click-follows-link)
+ (< (- t0 t1) mouse-1-click-follows-link))))))))
+ ;; Reselect previous selected window,
+ ;; so that the mouse-2 event runs in the same
+ ;; situation as if user had clicked it directly.
+ ;; Fixes the bug reported by juri@jurta.org on 2005-12-27.
+ (select-window original-window)
+ (if (or (vectorp on-link) (stringp on-link))
+ (setq event (aref on-link 0))
+ (setcar event 'mouse-2)))
(push event unread-command-events))))
;; Case where the end-event is not a cons cell (it's just a boring