Subject: bug#22000: Patch addressing the menu-bar frame-resize interaction

From: Vivek Dasmohapatra <[email-masked]>
Date: Tue, 17 Jul 2018 20:02:12 +0100 (BST)

>> The height of the initial window goes down from 35 lines (630 pixels)
>> to 33 lines (595 pixels).

This patch (added on top of the previous one) should fix the frame 
size calculation.

Still looking into whether there's a purely truncating solution.
From eaae86389d2862dc10804f45161f07cb475b49a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vivek=20Das=C2=A0Mohapatra?= <[email-masked]>
Date: Tue, 17 Jul 2018 19:53:42 +0100
Subject: [PATCH 2/2] GTK3 - correct frame height calculation with scrollable
 menu bars

The frame height calculation needs to be done based on the new
scrollable window that wraps the menu bars to be accurate.
---
 src/gtkutil.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gtkutil.c b/src/gtkutil.c
index d16274f6ab..dc78976d22 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3445,7 +3445,11 @@ menubar_map_cb (GtkWidget *w, gpointer user_data)
 {
   GtkRequisition req;
   struct frame *f = user_data;
-  gtk_widget_get_preferred_size (w, NULL, &req);
+  struct x_output *x = f->output_data.x;
+
+  /* Use the menubar viewport for size if there is one: */
+  gtk_widget_get_preferred_size (x->menubar_viewport ?: w, NULL, &req);
+
   if (FRAME_MENUBAR_HEIGHT (f) != req.height)
     {
       FRAME_MENUBAR_HEIGHT (f) = req.height;
@@ -3498,7 +3502,7 @@ xg_update_frame_menubar (struct frame *f)
 
   g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f);
   gtk_widget_show_all (x->menubar_viewport);
-  gtk_widget_get_preferred_size (x->menubar_widget, NULL, &req);
+  gtk_widget_get_preferred_size (x->menubar_viewport, NULL, &req);
 
   if (FRAME_MENUBAR_HEIGHT (f) != req.height)
     {
-- 
2.11.0