diff options
| author | Jan Djärv | 2010-11-20 14:50:55 +0100 |
|---|---|---|
| committer | Jan Djärv | 2010-11-20 14:50:55 +0100 |
| commit | 8d7f026f625a02854b3214f7a54e778121d266bc (patch) | |
| tree | 22a2d9aa7687bd0525c11eb45c52359b1b284238 /src | |
| parent | 4b320a0146c7c068079b756624579eef6580b503 (diff) | |
| download | emacs-8d7f026f625a02854b3214f7a54e778121d266bc.tar.gz emacs-8d7f026f625a02854b3214f7a54e778121d266bc.zip | |
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).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/gtkutil.c | 30 |
2 files changed, 34 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6268dcf33ae..4655ea714ad 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-11-20 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * gtkutil.c (menubar_map_cb): New function (Bug#7425). | ||
| 4 | (xg_update_frame_menubar): Connect signal map to menubar_map_cb. | ||
| 5 | Use 23 as menubar height if 0. (Bug#7425). | ||
| 6 | |||
| 1 | 2010-11-14 Jan Djärv <jan.h.d@swipnet.se> | 7 | 2010-11-14 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 8 | ||
| 3 | * xsettings.c (init_gconf): Check HAVE_G_TYPE_INIT. | 9 | * xsettings.c (init_gconf): Check HAVE_G_TYPE_INIT. |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 7a25bbb1e3f..7102823a814 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -2936,6 +2936,23 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p, | |||
| 2936 | gtk_widget_show_all (menubar); | 2936 | gtk_widget_show_all (menubar); |
| 2937 | } | 2937 | } |
| 2938 | 2938 | ||
| 2939 | /* Callback called when the menu bar W is mapped. | ||
| 2940 | Used to find the height of the menu bar if we didn't get it | ||
| 2941 | after showing the widget. */ | ||
| 2942 | |||
| 2943 | static void | ||
| 2944 | menubar_map_cb (GtkWidget *w, gpointer user_data) | ||
| 2945 | { | ||
| 2946 | GtkRequisition req; | ||
| 2947 | FRAME_PTR f = (FRAME_PTR) user_data; | ||
| 2948 | gtk_widget_size_request (w, &req); | ||
| 2949 | if (FRAME_MENUBAR_HEIGHT (f) != req.height) | ||
| 2950 | { | ||
| 2951 | FRAME_MENUBAR_HEIGHT (f) = req.height; | ||
| 2952 | xg_height_changed (f); | ||
| 2953 | } | ||
| 2954 | } | ||
| 2955 | |||
| 2939 | /* Recompute all the widgets of frame F, when the menu bar has been | 2956 | /* Recompute all the widgets of frame F, when the menu bar has been |
| 2940 | changed. Value is non-zero if widgets were updated. */ | 2957 | changed. Value is non-zero if widgets were updated. */ |
| 2941 | 2958 | ||
| @@ -2958,10 +2975,19 @@ xg_update_frame_menubar (f) | |||
| 2958 | FALSE, FALSE, 0); | 2975 | FALSE, FALSE, 0); |
| 2959 | gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0); | 2976 | gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0); |
| 2960 | 2977 | ||
| 2978 | g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f); | ||
| 2961 | gtk_widget_show_all (x->menubar_widget); | 2979 | gtk_widget_show_all (x->menubar_widget); |
| 2962 | gtk_widget_size_request (x->menubar_widget, &req); | 2980 | gtk_widget_size_request (x->menubar_widget, &req); |
| 2963 | FRAME_MENUBAR_HEIGHT (f) = req.height; | 2981 | /* If menu bar doesn't know its height yet, cheat a little so the frame |
| 2964 | xg_height_changed (f); | 2982 | doesn't jump so much when resized later in menubar_map_cb. */ |
| 2983 | if (req.height == 0) | ||
| 2984 | req.height = 23; | ||
| 2985 | |||
| 2986 | if (FRAME_MENUBAR_HEIGHT (f) != req.height) | ||
| 2987 | { | ||
| 2988 | FRAME_MENUBAR_HEIGHT (f) = req.height; | ||
| 2989 | xg_height_changed (f); | ||
| 2990 | } | ||
| 2965 | UNBLOCK_INPUT; | 2991 | UNBLOCK_INPUT; |
| 2966 | 2992 | ||
| 2967 | return 1; | 2993 | return 1; |