]> git.eshelyaron.com Git - emacs.git/commitdiff
(tree-widget-button-click): New function.
authorDavid Ponce <david@dponce.com>
Tue, 18 Oct 2005 11:30:18 +0000 (11:30 +0000)
committerDavid Ponce <david@dponce.com>
Tue, 18 Oct 2005 11:30:18 +0000 (11:30 +0000)
(tree-widget-button-keymap): Use it.

lisp/tree-widget.el

index 708dc294f8d84f31e1aa9198394793f5d0097a92..8ee1d5f9ed96f64ab1abe4100422b8578f040a38 100644 (file)
@@ -434,16 +434,25 @@ Return the image found, or nil if not found."
 \f
 ;;; 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
   (let ((km (make-sparse-keymap)))
     (if (boundp 'widget-button-keymap)
         ;; XEmacs
         (progn
           (set-keymap-parent km widget-button-keymap)
-          (define-key km [button1] 'widget-button-click))
+          (define-key km [button1] 'tree-widget-button-click))
       ;; Emacs
       (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)
   "Keymap used inside node buttons.
 Handle mouse button 1 click on buttons.")