changeset 66187:5955934355f2

(tree-widget-button-click): New function. (tree-widget-button-keymap): Use it.
author David Ponce <david@dponce.com>
date Tue, 18 Oct 2005 11:30:18 +0000
parents cf730526106e
children fe198c9ace5c
files lisp/tree-widget.el
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/tree-widget.el	Tue Oct 18 11:29:55 2005 +0000
+++ b/lisp/tree-widget.el	Tue Oct 18 11:30:18 2005 +0000
@@ -434,16 +434,25 @@
 
 ;;; 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.")