82 |
(other :tag "Single click" t)) |
(other :tag "Single click" t)) |
83 |
:group 'mouse) |
:group 'mouse) |
84 |
|
|
85 |
|
(defcustom mouse-1-click-in-non-selected-windows t |
86 |
|
"*If non-nil, a Mouse-1 click also follows links in non-selected windows. |
87 |
|
|
88 |
|
If nil, a Mouse-1 click on a link in a non-selected window performs |
89 |
|
the normal mouse-1 binding, typically selects the window and sets |
90 |
|
point at the click position." |
91 |
|
:type 'boolean |
92 |
|
:version "22.1" |
93 |
|
:group 'mouse) |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
;; Provide a mode-specific menu on a mouse button. |
;; Provide a mode-specific menu on a mouse button. |
98 |
|
|
782 |
"Return non-nil if POS is on a link in the current buffer. |
"Return non-nil if POS is on a link in the current buffer. |
783 |
POS must be a buffer position in the current buffer or an mouse |
POS must be a buffer position in the current buffer or an mouse |
784 |
event location in the selected window, see `event-start'. |
event location in the selected window, see `event-start'. |
785 |
|
However, if `mouse-1-click-in-non-selected-windows' is non-nil, |
786 |
|
POS may be a mouse event location in any window. |
787 |
|
|
788 |
A clickable link is identified by one of the following methods: |
A clickable link is identified by one of the following methods: |
789 |
|
|
818 |
|
|
819 |
- Otherwise, the mouse-1 event is translated into a mouse-2 event |
- Otherwise, the mouse-1 event is translated into a mouse-2 event |
820 |
at the same position." |
at the same position." |
821 |
(if (consp pos) |
(let ((w (and (consp pos) (posn-window pos)))) |
822 |
(setq pos (and (eq (selected-window) (posn-window pos)) |
(if (consp pos) |
823 |
(posn-point pos)))) |
(setq pos (and (or mouse-1-click-in-non-selected-windows |
824 |
(when pos |
(eq (selected-window) w)) |
825 |
(let ((action |
(posn-point pos)))) |
826 |
(or (get-char-property pos 'follow-link) |
(when pos |
827 |
(save-excursion |
(with-current-buffer (window-buffer w) |
828 |
(goto-char pos) |
(let ((action |
829 |
(key-binding [follow-link] nil t))))) |
(or (get-char-property pos 'follow-link) |
830 |
(cond |
(save-excursion |
831 |
((eq action 'mouse-face) |
(goto-char pos) |
832 |
(and (get-char-property pos 'mouse-face) t)) |
(key-binding [follow-link] nil t))))) |
833 |
((functionp action) |
(cond |
834 |
(funcall action pos)) |
((eq action 'mouse-face) |
835 |
(t action))))) |
(and (get-char-property pos 'mouse-face) t)) |
836 |
|
((functionp action) |
837 |
|
(funcall action pos)) |
838 |
|
(t action))))))) |
839 |
|
|
840 |
|
|
841 |
(defun mouse-drag-region-1 (start-event) |
(defun mouse-drag-region-1 (start-event) |
855 |
;; Don't count the mode line. |
;; Don't count the mode line. |
856 |
(1- (nth 3 bounds)))) |
(1- (nth 3 bounds)))) |
857 |
(on-link (and mouse-1-click-follows-link |
(on-link (and mouse-1-click-follows-link |
858 |
(eq start-window (selected-window)))) |
(or mouse-1-click-in-non-selected-windows |
859 |
|
(eq start-window (selected-window))))) |
860 |
remap-double-click |
remap-double-click |
861 |
(click-count (1- (event-click-count start-event)))) |
(click-count (1- (event-click-count start-event)))) |
862 |
(setq mouse-selection-click-count click-count) |
(setq mouse-selection-click-count click-count) |