summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2006-06-20 18:08:40 +0000
committerChong Yidong <cyd@stupidchicken.com>2006-06-20 18:08:40 +0000
commitae179a0e48d12f6163e197d7dd74dfb3b772962f (patch)
treeb749efa50ba93dcec9de3a82d76ad20bb6c6fb84
parent16ff18ea53f327449d1d20e13844d3efd1c530eb (diff)
downloademacs-ae179a0e48d12f6163e197d7dd74dfb3b772962f.tar.gz
* msb.el (msb): Move `sit-for' hack here to handle both
"mouse-down and drag" and "mouse-up and select" situations. (mouse-select-buffer): Move `sit-for' hack to `msb'.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/msb.el20
2 files changed, 16 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2c174cb6360..60a8e901a6b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-20 Chong Yidong <cyd@stupidchicken.com>
+
+ * msb.el (msb): Move `sit-for' hack here to handle both
+ "mouse-down and drag" and "mouse-up and select" situations.
+ (mouse-select-buffer): Move `sit-for' hack to `msb'.
+
2006-06-20 Kenichi Handa <handa@m17n.org>
* international/characters.el (word-combining-categories): Add
diff --git a/lisp/msb.el b/lisp/msb.el
index d5f32486971..aa42e183007 100644
--- a/lisp/msb.el
+++ b/lisp/msb.el
@@ -473,18 +473,21 @@ selects that window.
See the function `mouse-select-buffer' and the variable
`msb-menu-cond' for more information about how the menus are split."
(interactive "e")
- ;; If EVENT is a down-event, read and discard the
- ;; corresponding up-event.
- (and (eventp event)
- (memq 'down (event-modifiers event))
- (read-event))
(let ((old-window (selected-window))
- (window (posn-window (event-start event))))
+ (window (posn-window (event-start event)))
+ early-release)
(unless (framep window) (select-window window))
+ ;; This `sit-for' magically makes the menu stay up if the mouse
+ ;; button is released within 0.1 second.
+ (setq early-release (not (sit-for 0.1 t)))
(let ((buffer (mouse-select-buffer event)))
(if buffer
(switch-to-buffer buffer)
- (select-window old-window))))
+ (select-window old-window)))
+ ;; If the above `sit-for' was interrupted by a mouse-up, avoid
+ ;; generating a drag event.
+ (if (and early-release (memq 'down (event-modifiers last-input-event)))
+ (discard-input)))
nil)
;;;
@@ -995,9 +998,6 @@ variable `msb-menu-cond'."
;; adjust position
(setq posX (- posX (funcall msb-horizontal-shift-function))
position (list (list posX posY) posWind))))
- ;; This `sit-for' magically makes the menu stay up if the mouse
- ;; button is released within 0.1 second.
- (sit-for 0 100)
;; Popup the menu
(setq choice (x-popup-menu position msb--last-buffer-menu))
(cond