Commit 42fbd808 authored by David Ponce's avatar David Ponce
Browse files

(tree-widget-button-click): New function.

(tree-widget-button-keymap): Use it.
parent 93883b09
...@@ -434,16 +434,25 @@ Return the image found, or nil if not found." ...@@ -434,16 +434,25 @@ Return the image found, or nil if not found."
;;; Widgets ;;; Widgets
;; ;;
(defun tree-widget-button-click (event)
"Move to the position clicked on, and if it is a button, invoke it.
EVENT is the mouse event received."
(interactive "e")
(mouse-set-point event)
(let ((pos (widget-event-point event)))
(if (get-char-property pos 'button)
(widget-button-click event))))
(defvar tree-widget-button-keymap (defvar tree-widget-button-keymap
(let ((km (make-sparse-keymap))) (let ((km (make-sparse-keymap)))
(if (boundp 'widget-button-keymap) (if (boundp 'widget-button-keymap)
;; XEmacs ;; XEmacs
(progn (progn
(set-keymap-parent km widget-button-keymap) (set-keymap-parent km widget-button-keymap)
(define-key km [button1] 'widget-button-click)) (define-key km [button1] 'tree-widget-button-click))
;; Emacs ;; Emacs
(set-keymap-parent km widget-keymap) (set-keymap-parent km widget-keymap)
(define-key km [down-mouse-1] 'widget-button-click)) (define-key km [down-mouse-1] 'tree-widget-button-click))
km) km)
"Keymap used inside node buttons. "Keymap used inside node buttons.
Handle mouse button 1 click on buttons.") Handle mouse button 1 click on buttons.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment