summaryrefslogtreecommitdiff
path: root/gtk/gtkapplicationwindow.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2012-01-14 13:26:09 -0500
committerMatthias Clasen <mclasen@redhat.com>2012-01-14 13:26:09 -0500
commiteced73c44176b657c9b621165be225422a9889e3 (patch)
tree6b7cfeb5e3f176b285a6da066730b04f7331427e /gtk/gtkapplicationwindow.c
parent7234a2617edbf109262859a2a4edd3a325664b77 (diff)
downloadgtk+-eced73c44176b657c9b621165be225422a9889e3.tar.gz
GtkApplicationWindow: Fix size-request logic
When finding the width for a given height, we can pass the full height to both the menubar and the content. Instead, give the menubar its minimum height, and give the rest to the content.
Diffstat (limited to 'gtk/gtkapplicationwindow.c')
-rw-r--r--gtk/gtkapplicationwindow.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c
index 777ab8dcd3..3bf318f3bc 100644
--- a/gtk/gtkapplicationwindow.c
+++ b/gtk/gtkapplicationwindow.c
@@ -603,15 +603,21 @@ gtk_application_window_real_get_preferred_width_for_height (GtkWidget *widget,
gint *natural_width)
{
GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);
+ gint menubar_height;
+
+ if (window->priv->menubar != NULL)
+ gtk_widget_get_preferred_height (window->priv->menubar, &menubar_height, NULL);
+ else
+ menubar_height = 0;
GTK_WIDGET_CLASS (gtk_application_window_parent_class)
- ->get_preferred_width_for_height (widget, height, minimum_width, natural_width);
+ ->get_preferred_width_for_height (widget, height - menubar_height, minimum_width, natural_width);
if (window->priv->menubar != NULL)
{
gint menubar_min_width, menubar_nat_width;
- gtk_widget_get_preferred_width_for_height (window->priv->menubar, height, &menubar_min_width, &menubar_nat_width);
+ gtk_widget_get_preferred_width_for_height (window->priv->menubar, menubar_height, &menubar_min_width, &menubar_nat_width);
*minimum_width = MAX (*minimum_width, menubar_min_width);
*natural_width = MAX (*natural_width, menubar_nat_width);
}