967 |
(recenter)) |
(recenter)) |
968 |
) |
) |
969 |
|
|
970 |
(let ((up t) command) |
(let ((up t) command) |
971 |
;; Mouse click not on a widget button. Find the global |
;; Mouse click not on a widget button. Find the global |
972 |
;; command to run, and check whether it is bound to an |
;; command to run, and check whether it is bound to an |
973 |
;; up event. |
;; up event. |
974 |
(mouse-set-point event) |
(mouse-set-point event) |
975 |
(if (memq (event-basic-type event) '(mouse-1 down-mouse-1)) |
(if (memq (event-basic-type event) '(mouse-1 down-mouse-1)) |
|
(cond ((setq command ;down event |
|
|
(lookup-key widget-global-map [down-mouse-1])) |
|
|
(setq up nil)) |
|
|
((setq command ;up event |
|
|
(lookup-key widget-global-map [mouse-1])))) |
|
976 |
(cond ((setq command ;down event |
(cond ((setq command ;down event |
977 |
(lookup-key widget-global-map [down-mouse-2])) |
(lookup-key widget-global-map [down-mouse-1])) |
978 |
(setq up nil)) |
(setq up nil)) |
979 |
((setq command ;up event |
((setq command ;up event |
980 |
(lookup-key widget-global-map [mouse-2]))))) |
(lookup-key widget-global-map [mouse-1])))) |
981 |
(when up |
(cond ((setq command ;down event |
982 |
;; Don't execute up events twice. |
(lookup-key widget-global-map [down-mouse-2])) |
983 |
(while (not (widget-button-release-event-p event)) |
(setq up nil)) |
984 |
(setq event (read-event)))) |
((setq command ;up event |
985 |
(when command |
(lookup-key widget-global-map [mouse-2]))))) |
986 |
(call-interactively command))))) |
(when up |
987 |
|
;; Don't execute up events twice. |
988 |
|
(while (not (widget-button-release-event-p event)) |
989 |
|
(setq event (read-event)))) |
990 |
|
(when command |
991 |
|
(call-interactively command))))) |
992 |
(message "You clicked somewhere weird."))) |
(message "You clicked somewhere weird."))) |
993 |
|
|
994 |
(defun widget-button-press (pos &optional event) |
(defun widget-button-press (pos &optional event) |