aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtkutil.c
diff options
context:
space:
mode:
authorChong Yidong2010-11-27 15:04:57 -0500
committerChong Yidong2010-11-27 15:04:57 -0500
commit07976ae3b816dea4fd541bbba862603d3132eb2c (patch)
tree4a437b7cb3abb01fb144530a130c991882a1b7f2 /src/gtkutil.c
parent9610796712a3bc43730c99005906571a2c0bccbd (diff)
parent402c8a49571227f8a4e678d4a6cdd6ba7841aef9 (diff)
downloademacs-07976ae3b816dea4fd541bbba862603d3132eb2c.tar.gz
emacs-07976ae3b816dea4fd541bbba862603d3132eb2c.zip
Merge changes from emacs-23 branch
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r--src/gtkutil.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 89b16a10fbc..b091df19905 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3074,6 +3074,23 @@ xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val,
3074 gtk_widget_show_all (menubar); 3074 gtk_widget_show_all (menubar);
3075} 3075}
3076 3076
3077/* Callback called when the menu bar W is mapped.
3078 Used to find the height of the menu bar if we didn't get it
3079 after showing the widget. */
3080
3081static void
3082menubar_map_cb (GtkWidget *w, gpointer user_data)
3083{
3084 GtkRequisition req;
3085 FRAME_PTR f = (FRAME_PTR) user_data;
3086 gtk_widget_size_request (w, &req);
3087 if (FRAME_MENUBAR_HEIGHT (f) != req.height)
3088 {
3089 FRAME_MENUBAR_HEIGHT (f) = req.height;
3090 xg_height_changed (f);
3091 }
3092}
3093
3077/* Recompute all the widgets of frame F, when the menu bar has been 3094/* Recompute all the widgets of frame F, when the menu bar has been
3078 changed. Value is non-zero if widgets were updated. */ 3095 changed. Value is non-zero if widgets were updated. */
3079 3096
@@ -3095,10 +3112,20 @@ xg_update_frame_menubar (FRAME_PTR f)
3095 FALSE, FALSE, 0); 3112 FALSE, FALSE, 0);
3096 gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0); 3113 gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0);
3097 3114
3115 g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f);
3098 gtk_widget_show_all (x->menubar_widget); 3116 gtk_widget_show_all (x->menubar_widget);
3099 gtk_widget_size_request (x->menubar_widget, &req); 3117 gtk_widget_size_request (x->menubar_widget, &req);
3100 FRAME_MENUBAR_HEIGHT (f) = req.height; 3118
3101 xg_height_or_width_changed (f); 3119 /* If menu bar doesn't know its height yet, cheat a little so the frame
3120 doesn't jump so much when resized later in menubar_map_cb. */
3121 if (req.height == 0)
3122 req.height = 23;
3123
3124 if (FRAME_MENUBAR_HEIGHT (f) != req.height)
3125 {
3126 FRAME_MENUBAR_HEIGHT (f) = req.height;
3127 xg_height_or_width_changed (f);
3128 }
3102 UNBLOCK_INPUT; 3129 UNBLOCK_INPUT;
3103 3130
3104 return 1; 3131 return 1;