Subject: Re: bug#24107: 25.1; menu-bar-size and tool-bar-size are reported inconsistently on w32

From: martin rudalics <[email-masked]>
Date: Sat, 30 Jul 2016 11:39:22 +0200

> OK, but this means you can compute the width of the tool bar as you do
 > for any other window, and then add to that the width of the fringes.
 > Since on Windows the tool bar is just a special window which doesn't
 > have fringes, this should be accurate, no?

It's not related to fringes.  I forgot to subtract the width of the
external borders.  Does the attached patch (mostly fixing indentation
hell) give the correct result?

martin
diff --git a/src/w32fns.c b/src/w32fns.c
index 584e311..2b07bb2 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -8465,24 +8465,25 @@ with offset DY added (default is -10).
 		Fcons (Qouter_size,
 		       Fcons (make_number (right - left),
 			      make_number (bottom - top))),
-	   Fcons (Qexternal_border_size,
+		Fcons (Qexternal_border_size,
 		       Fcons (make_number (external_border_width),
 			      make_number (external_border_height))),
 		Fcons (Qtitle_bar_size,
 		       Fcons (make_number (title_bar_width),
 			      make_number (title_bar_height))),
-	   Fcons (Qmenu_bar_external, Qt),
-	   Fcons (Qmenu_bar_size,
-		  Fcons (make_number
-			 (menu_bar.rcBar.right - menu_bar.rcBar.left),
-			 make_number (menu_bar_height))),
-	   Fcons (Qtool_bar_external, Qnil),
+		Fcons (Qmenu_bar_external, Qt),
+		Fcons (Qmenu_bar_size,
+		       Fcons (make_number
+			      (menu_bar.rcBar.right - menu_bar.rcBar.left),
+			      make_number (menu_bar_height))),
+		Fcons (Qtool_bar_external, Qnil),
 		Fcons (Qtool_bar_position, tool_bar_height ? Qtop : Qnil),
-	   Fcons (Qtool_bar_size,
+		Fcons (Qtool_bar_size,
 		       Fcons (make_number
 			      (tool_bar_height
-			       ? right - left - 2 * internal_border_width
-				      : 0),
+			       ? (right - left - 2 * external_border_width
+				  - 2 * internal_border_width)
+			       : 0),
 			      make_number (tool_bar_height))),
 		Fcons (Qinternal_border_width,
 		       make_number (internal_border_width)));