diff options
| author | Richard M. Stallman | 2005-12-28 03:19:29 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-12-28 03:19:29 +0000 |
| commit | 18e980c2ae616c850f2786bd889c26b0eab71ff3 (patch) | |
| tree | fcebd5961fb41a9fea9149bce536d5e351a20101 | |
| parent | 1d69c502649e3444975791b4553fbe537cd4c0cc (diff) | |
| download | emacs-18e980c2ae616c850f2786bd889c26b0eab71ff3.tar.gz emacs-18e980c2ae616c850f2786bd889c26b0eab71ff3.zip | |
(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.
| -rw-r--r-- | lisp/mouse.el | 43 |
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." | |||
| 1002 | (or end-point | 1002 | (or end-point |
| 1003 | (= (window-start start-window) | 1003 | (= (window-start start-window) |
| 1004 | start-window-start))) | 1004 | start-window-start))) |
| 1005 | (if (and on-link | 1005 | (when (and on-link |
| 1006 | (or (not end-point) (= end-point start-point)) | 1006 | (or (not end-point) (= end-point start-point)) |
| 1007 | (consp event) | 1007 | (consp event) |
| 1008 | (or remap-double-click | 1008 | (or remap-double-click |
| 1009 | (and | 1009 | (and |
| 1010 | (not (eq mouse-1-click-follows-link 'double)) | 1010 | (not (eq mouse-1-click-follows-link 'double)) |
| 1011 | (= click-count 0) | 1011 | (= click-count 0) |
| 1012 | (= (event-click-count event) 1) | 1012 | (= (event-click-count event) 1) |
| 1013 | (not (input-pending-p)) | 1013 | (not (input-pending-p)) |
| 1014 | (or (not (integerp mouse-1-click-follows-link)) | 1014 | (or (not (integerp mouse-1-click-follows-link)) |
| 1015 | (let ((t0 (posn-timestamp (event-start start-event))) | 1015 | (let ((t0 (posn-timestamp (event-start start-event))) |
| 1016 | (t1 (posn-timestamp (event-end event)))) | 1016 | (t1 (posn-timestamp (event-end event)))) |
| 1017 | (and (integerp t0) (integerp t1) | 1017 | (and (integerp t0) (integerp t1) |
| 1018 | (if (> mouse-1-click-follows-link 0) | 1018 | (if (> mouse-1-click-follows-link 0) |
| 1019 | (<= (- t1 t0) mouse-1-click-follows-link) | 1019 | (<= (- t1 t0) mouse-1-click-follows-link) |
| 1020 | (< (- t0 t1) mouse-1-click-follows-link)))))))) | 1020 | (< (- t0 t1) mouse-1-click-follows-link)))))))) |
| 1021 | (if (or (vectorp on-link) (stringp on-link)) | 1021 | ;; Reselect previous selected window, |
| 1022 | (setq event (aref on-link 0)) | 1022 | ;; so that the mouse-2 event runs in the same |
| 1023 | (setcar event 'mouse-2))) | 1023 | ;; situation as if user had clicked it directly. |
| 1024 | ;; Fixes the bug reported by juri@jurta.org on 2005-12-27. | ||
| 1025 | (select-window original-window) | ||
| 1026 | (if (or (vectorp on-link) (stringp on-link)) | ||
| 1027 | (setq event (aref on-link 0)) | ||
| 1028 | (setcar event 'mouse-2))) | ||
| 1024 | (push event unread-command-events)))) | 1029 | (push event unread-command-events)))) |
| 1025 | 1030 | ||
| 1026 | ;; Case where the end-event is not a cons cell (it's just a boring | 1031 | ;; Case where the end-event is not a cons cell (it's just a boring |