summaryrefslogtreecommitdiff
path: root/lisp/menu-bar.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2010-12-09 20:53:17 +0200
committerEli Zaretskii <eliz@gnu.org>2010-12-09 20:53:17 +0200
commit65ceb118c42c59b0ff36aeae20ad0f3b53842501 (patch)
treeb3982a2c9753d3fe14bab87671eb71b7ead248d9 /lisp/menu-bar.el
parent81ced43d179308153dfba3eece877e84c4091dea (diff)
downloademacs-65ceb118c42c59b0ff36aeae20ad0f3b53842501.tar.gz
Fix bug #1077 with popping new frames from a minibuffer-only frame.
Do NOT merge with trunk! menu-bar.el (menu-bar-frame-for-menubar, menu-bar-positive-p): New functions. (menu-bar-showhide-menu) <menu-bar-mode, showhide-tool-bar>: Use them instead of `nil' and `>', respectively.
Diffstat (limited to 'lisp/menu-bar.el')
-rw-r--r--lisp/menu-bar.el21
1 files changed, 19 insertions, 2 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index d25de5b385c..1f97ea76847 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -980,16 +980,33 @@ mail status in mode line"))
:visible (and (display-graphic-p) (fboundp 'x-show-tip))
:button (:toggle . tooltip-mode)))
+(defun menu-bar-frame-for-menubar ()
+ "Return the frame suitable for updating the menu bar."
+ (or (and (framep menu-updating-frame)
+ menu-updating-frame)
+ (selected-frame)))
+
+(defun menu-bar-positive-p (val)
+ "Return non-nil iff VAL is a positive number."
+ (and (numberp val)
+ (> val 0)))
+
(define-key menu-bar-showhide-menu [menu-bar-mode]
`(menu-item ,(purecopy "Menu-bar") toggle-menu-bar-mode-from-frame
:help ,(purecopy "Turn menu-bar on/off")
- :button (:toggle . (> (frame-parameter nil 'menu-bar-lines) 0))))
+ :button
+ (:toggle . (menu-bar-positive-p
+ (frame-parameter (menu-bar-frame-for-menubar)
+ 'menu-bar-lines)))))
(define-key menu-bar-showhide-menu [showhide-tool-bar]
`(menu-item ,(purecopy "Tool-bar") toggle-tool-bar-mode-from-frame
:help ,(purecopy "Turn tool-bar on/off")
:visible (display-graphic-p)
- :button (:toggle . (> (frame-parameter nil 'tool-bar-lines) 0))))
+ :button
+ (:toggle . (menu-bar-positive-p
+ (frame-parameter (menu-bar-frame-for-menubar)
+ 'tool-bar-lines)))))
(define-key menu-bar-options-menu [showhide]
`(menu-item ,(purecopy "Show/Hide") ,menu-bar-showhide-menu))