emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100221: Fix bug 7425.


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100221: Fix bug 7425.
Date: Sat, 20 Nov 2010 14:50:55 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100221
committer: Jan D. <address@hidden>
branch nick: emacs-23
timestamp: Sat 2010-11-20 14:50:55 +0100
message:
  Fix bug 7425.
  
  NOTE: When merging to trunk: xg_height_changed is xg_height_or_width_changed
        in trunk.
  
  * src/gtkutil.c (menubar_map_cb): New function.
  (xg_update_frame_menubar): Connect signal map to menubar_map_cb.
  Use 23 as menubar height if 0. (Bug#7425).
modified:
  src/ChangeLog
  src/gtkutil.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-11-14 11:47:31 +0000
+++ b/src/ChangeLog     2010-11-20 13:50:55 +0000
@@ -1,3 +1,9 @@
+2010-11-20  Jan Djärv  <address@hidden>
+
+       * gtkutil.c (menubar_map_cb): New function (Bug#7425).
+       (xg_update_frame_menubar): Connect signal map to menubar_map_cb.
+       Use 23 as menubar height if 0. (Bug#7425).
+
 2010-11-14  Jan Djärv  <address@hidden>
 
        * xsettings.c (init_gconf): Check HAVE_G_TYPE_INIT.

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2010-09-17 09:58:44 +0000
+++ b/src/gtkutil.c     2010-11-20 13:50:55 +0000
@@ -2936,6 +2936,23 @@
   gtk_widget_show_all (menubar);
 }
 
+/* Callback called when the menu bar W is mapped.
+   Used to find the height of the menu bar if we didn't get it
+   after showing the widget.  */
+
+static void
+menubar_map_cb (GtkWidget *w, gpointer user_data)
+{
+  GtkRequisition req;
+  FRAME_PTR f = (FRAME_PTR) user_data;
+  gtk_widget_size_request (w, &req);
+  if (FRAME_MENUBAR_HEIGHT (f) != req.height) 
+    {
+      FRAME_MENUBAR_HEIGHT (f) = req.height;
+      xg_height_changed (f);
+    }
+}
+
 /* Recompute all the widgets of frame F, when the menu bar has been
    changed.  Value is non-zero if widgets were updated.  */
 
@@ -2958,10 +2975,19 @@
                       FALSE, FALSE, 0);
   gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0);
 
+  g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f);
   gtk_widget_show_all (x->menubar_widget);
   gtk_widget_size_request (x->menubar_widget, &req);
-  FRAME_MENUBAR_HEIGHT (f) = req.height;
-  xg_height_changed (f);
+  /* If menu bar doesn't know its height yet, cheat a little so the frame
+     doesn't jump so much when resized later in menubar_map_cb.  */
+  if (req.height == 0)
+    req.height = 23;
+
+  if (FRAME_MENUBAR_HEIGHT (f) != req.height)
+    {
+      FRAME_MENUBAR_HEIGHT (f) = req.height;
+      xg_height_changed (f);
+    }
   UNBLOCK_INPUT;
 
   return 1;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]