diff lisp/toolbar.el @ 763:47ae55dda777

[xemacs-hg @ 2002-03-05 12:53:10 by stephent] preserve window size on toolbar reposition <87664idofd.fsf@tleeps18.sk.tsukuba.ac.jp>
author stephent
date Tue, 05 Mar 2002 12:53:11 +0000
parents 7039e6323819
children af0baad5ba14
line wrap: on
line diff
--- a/lisp/toolbar.el	Tue Mar 05 12:44:46 2002 +0000
+++ b/lisp/toolbar.el	Tue Mar 05 12:53:11 2002 +0000
@@ -32,8 +32,8 @@
 
 (defcustom toolbar-visible-p ;; added for the options menu - dverna apr. 98
   (specifier-instance default-toolbar-visible-p)
-  "Whether the default toolbar is globally visible. This option can be
-customized through the options menu."
+  "*Whether the default toolbar is globally visible.
+This option can be customized through the options menu."
   :group 'display
   :type 'boolean
   :set #'(lambda (var val)
@@ -43,8 +43,8 @@
 
 (defcustom toolbar-captioned-p ;; added for the options menu - dverna apr. 98
   (specifier-instance toolbar-buttons-captioned-p)
-  "Whether the toolbars buttons are globally captioned. This option can be
-customized through the options menu."
+  "*Whether the toolbars buttons are globally captioned.
+This option can be customized through the options menu."
   :group 'display
   :type 'boolean
   :set #'(lambda (var val)
@@ -54,16 +54,26 @@
 
 (defcustom default-toolbar-position ;; added for the options menu - dverna
   (default-toolbar-position)
-  "The location of the default toolbar. It can be 'top, 'bottom, 'left or
-'right. This option can be customized through the options menu."
+  "*The location of the default toolbar: 'top, 'bottom, 'left, or 'right.
+This option can be customized through the options menu."
   :group 'display
   :type '(choice (const :tag "top" top)
 		 (const :tag "bottom" bottom)
 		 (const :tag "left" left)
 		 (const :tag "right" right))
   :set #'(lambda (var val)
-	   (set-default-toolbar-position val)
-	   (setq default-toolbar-position val))
+	   (let* ((height (window-height))
+		  (hdiff (- (frame-height) height))
+		  (width (window-width)))
+	     (set-default-toolbar-position val)
+	     (setq default-toolbar-position val)
+	     ;; needed or dimensions don't update?
+	     (redisplay-frame)
+	     ;; This probably only works correctly if there is only one
+	     ;; Emacs window.  If windows are split, it probably results in
+	     ;; small adjustments in their sizes.
+	     (set-frame-size (selected-frame) width (+ height hdiff))
+	     )
   )
 
 (defvar toolbar-help-enabled t