summaryrefslogtreecommitdiff
path: root/lisp/tool-bar.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2010-06-26 20:30:52 -0400
committerChong Yidong <cyd@stupidchicken.com>2010-06-26 20:30:52 -0400
commit6431f2e619d1ce4cff097a3837f6b9e931f1f61a (patch)
treedbb4f0ef7419becd60a7a03b5f0b2558f258594f /lisp/tool-bar.el
parent394f238630dc4904435c15dad92727a900916b97 (diff)
downloademacs-6431f2e619d1ce4cff097a3837f6b9e931f1f61a.tar.gz
Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Don't add entries for `menu-bar-lines' and `tool-bar-lines' to `default-frame-alist' and `initial-frame-alist' at startup. Instead, use X resources to update the `menu-bar-mode' and `tool-bar-mode' variables at startup, and use them as defaults during frame creation. * lisp/frame.el (frame-notice-user-settings): Don't change default-frame-alist based on menu-bar-mode and tool-bar-mode, or vice versa. * lisp/menu-bar.el (menu-bar-mode): * lisp/tool-bar.el (tool-bar-mode): Don't change default-frame-alist. Set init-value to t. * lisp/startup.el (command-line): Use X resources to set the value of menu-bar-mode and tool-bar-mode, before calling frame-initialize. * src/frame.c (Vmenu_bar_mode, Vtool_bar_mode): New vars. * src/w32fns.c (Fx_create_frame): * src/nsfns.m (Fx_create_frame): Likewise. * src/xfns.c (Fx_create_frame): Don't consult X resouces when setting menu-bar-lines and tool-bar-lines. Use menu-bar-mode and tool-bar-mode, which are now set using these X resources at startup, to determine the defaults.
Diffstat (limited to 'lisp/tool-bar.el')
-rw-r--r--lisp/tool-bar.el31
1 files changed, 8 insertions, 23 deletions
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index a05d05daeb9..eaa8551b019 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -48,21 +48,17 @@ With numeric ARG, display the tool bar if and only if ARG is positive.
See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for
conveniently adding tool bar items."
- :init-value nil
+ :init-value t
:global t
:group 'mouse
:group 'frames
- (if tool-bar-mode
- (progn
- ;; Make one tool-bar-line for any - including non-graphical -
- ;; terminal, see Bug#1754. If this causes problems, we should
- ;; handle the problem in `modify-frame-parameters' or do not
- ;; call `modify-all-frames-parameters' when toggling the tool
- ;; bar off either.
- (modify-all-frames-parameters (list (cons 'tool-bar-lines 1)))
- (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
- (tool-bar-setup)))
- (modify-all-frames-parameters (list (cons 'tool-bar-lines 0)))))
+ ;; Make tool-bar even if terminal is non-graphical (Bug#1754).
+ (let ((val (if tool-bar-mode 1 0)))
+ (dolist (frame (frame-list))
+ (set-frame-parameter frame 'tool-bar-lines val)))
+ (when tool-bar-mode
+ (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
+ (tool-bar-setup))))
;;;###autoload
;; Used in the Show/Hide menu, to have the toggle reflect the current frame.
@@ -74,17 +70,6 @@ See `tool-bar-mode' for more information."
(tool-bar-mode (if (> (frame-parameter nil 'tool-bar-lines) 0) 0 1))
(tool-bar-mode arg)))
-;;;###autoload
-;; We want to pretend the toolbar by standard is on, as this will make
-;; customize consider disabling the toolbar a customization, and save
-;; that. We could do this for real by setting :init-value above, but
-;; that would turn on the toolbar in MS Windows where it is currently
-;; useless, and it would overwrite disabling the tool bar from X
-;; resources. If anyone want to implement this in a cleaner way,
-;; please do so.
-;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-21.
-(put 'tool-bar-mode 'standard-value '(t))
-
(defvar tool-bar-map (make-sparse-keymap)
"Keymap for the tool bar.
Define this locally to override the global tool bar.")