From: Richard M. Stallman Date: Mon, 18 Sep 2006 15:39:50 +0000 (+0000) Subject: (widget-button-click): Handle non-mouse-motion events X-Git-Tag: emacs-pretest-22.0.90~488 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0fdbf6bc76533b093a74318d8ac6256a93e4c43a;p=emacs.git (widget-button-click): Handle non-mouse-motion events that might come in during mouse tracking. --- diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index fc64dd5f361..e518fff34fa 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -959,15 +959,18 @@ Recommended as a parent keymap for modes using widgets.") (push event unread-command-events) (setq event oevent) (throw 'button-press-cancelled t)) - (setq pos (widget-event-point event)) - (if (and pos - (eq (get-char-property pos 'button) - button)) - (when face - (overlay-put overlay 'face pressed-face) - (overlay-put overlay 'mouse-face pressed-face)) - (overlay-put overlay 'face face) - (overlay-put overlay 'mouse-face mouse-face))))) + (unless (or (integerp event) + (memq (car event) '(switch-frame select-window)) + (eq (car event) 'scroll-bar-movement)) + (setq pos (widget-event-point event)) + (if (and pos + (eq (get-char-property pos 'button) + button)) + (when face + (overlay-put overlay 'face pressed-face) + (overlay-put overlay 'mouse-face pressed-face)) + (overlay-put overlay 'face face) + (overlay-put overlay 'mouse-face mouse-face)))))) ;; When mouse is released over the button, run ;; its action function.