mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 14:50:06 +00:00
window: Remove overeagerness with new size guessing
Don't use the guessed size when we are interested in the minimum size.
So now we can really shrink menubars.
This reverts parts of 08b2ac1d90
This commit is contained in:
parent
f74df9ba70
commit
406b2e9e58
@ -7176,13 +7176,16 @@ gtk_window_compute_hints (GtkWindow *window,
|
||||
guint *new_flags)
|
||||
{
|
||||
GtkWindowPrivate *priv = window->priv;
|
||||
GtkWidget *widget;
|
||||
gint extra_width = 0;
|
||||
gint extra_height = 0;
|
||||
GtkWindowGeometryInfo *geometry_info;
|
||||
int width, height;
|
||||
GtkRequisition requisition;
|
||||
|
||||
gtk_window_guess_default_size (window, &width, &height);
|
||||
geometry_info = gtk_window_get_geometry_info (window, FALSE);
|
||||
widget = GTK_WIDGET (window);
|
||||
|
||||
gtk_widget_get_preferred_size (widget, &requisition, NULL);
|
||||
geometry_info = gtk_window_get_geometry_info (GTK_WINDOW (widget), FALSE);
|
||||
|
||||
if (geometry_info)
|
||||
{
|
||||
@ -7224,7 +7227,7 @@ gtk_window_compute_hints (GtkWindow *window,
|
||||
_gtk_widget_override_size_request (geometry_info->widget,
|
||||
TEMPORARY_SIZE, TEMPORARY_SIZE,
|
||||
¤t_width, ¤t_height);
|
||||
gtk_widget_get_preferred_size (GTK_WIDGET (window),
|
||||
gtk_widget_get_preferred_size (widget,
|
||||
&requisition, NULL);
|
||||
_gtk_widget_restore_size_request (geometry_info->widget,
|
||||
current_width, current_height);
|
||||
@ -7279,32 +7282,32 @@ gtk_window_compute_hints (GtkWindow *window,
|
||||
if (*new_flags & GDK_HINT_MIN_SIZE)
|
||||
{
|
||||
if (new_geometry->min_width < 0)
|
||||
new_geometry->min_width = width;
|
||||
new_geometry->min_width = requisition.width;
|
||||
else
|
||||
new_geometry->min_width = MAX (width, new_geometry->min_width + extra_width);
|
||||
new_geometry->min_width = MAX (requisition.width, new_geometry->min_width + extra_width);
|
||||
|
||||
if (new_geometry->min_height < 0)
|
||||
new_geometry->min_height = height;
|
||||
new_geometry->min_height = requisition.height;
|
||||
else
|
||||
new_geometry->min_height = MAX (height, new_geometry->min_height + extra_height);
|
||||
new_geometry->min_height = MAX (requisition.height, new_geometry->min_height + extra_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
*new_flags |= GDK_HINT_MIN_SIZE;
|
||||
|
||||
new_geometry->min_width = width;
|
||||
new_geometry->min_height = height;
|
||||
new_geometry->min_width = requisition.width;
|
||||
new_geometry->min_height = requisition.height;
|
||||
}
|
||||
|
||||
if (*new_flags & GDK_HINT_MAX_SIZE)
|
||||
{
|
||||
if (new_geometry->max_width < 0)
|
||||
new_geometry->max_width = width;
|
||||
new_geometry->max_width = requisition.width;
|
||||
else
|
||||
new_geometry->max_width += extra_width;
|
||||
|
||||
if (new_geometry->max_height < 0)
|
||||
new_geometry->max_height = height;
|
||||
new_geometry->max_height = requisition.height;
|
||||
else
|
||||
new_geometry->max_height += extra_height;
|
||||
}
|
||||
@ -7312,8 +7315,8 @@ gtk_window_compute_hints (GtkWindow *window,
|
||||
{
|
||||
*new_flags |= GDK_HINT_MAX_SIZE;
|
||||
|
||||
new_geometry->max_width = width;
|
||||
new_geometry->max_height = height;
|
||||
new_geometry->max_width = requisition.width;
|
||||
new_geometry->max_height = requisition.height;
|
||||
}
|
||||
|
||||
*new_flags |= GDK_HINT_WIN_GRAVITY;
|
||||
|
Loading…
Reference in New Issue
Block a user