mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 07:04:29 +00:00
Merge branch 'matthias/fix-min-size' into 'master'
Matthias/fix min size See merge request GNOME/gtk!2404
This commit is contained in:
commit
1ccab92813
@ -99,6 +99,7 @@ gdk_toplevel_notify_compute_size (GdkToplevel *toplevel,
|
||||
GdkToplevelSize *size)
|
||||
{
|
||||
g_signal_emit (toplevel, signals[COMPUTE_SIZE], 0, size);
|
||||
gdk_toplevel_size_validate (size);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -117,3 +117,19 @@ gdk_toplevel_size_set_min_size (GdkToplevelSize *size,
|
||||
size->min_width = min_width;
|
||||
size->min_height = min_height;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_toplevel_size_validate (GdkToplevelSize *size)
|
||||
{
|
||||
if (size->min_width > size->bounds_width ||
|
||||
size->min_height > size->bounds_height)
|
||||
g_warning ("GdkToplevelSize: min_size exceeds bounds");
|
||||
|
||||
if (size->width > size->bounds_width ||
|
||||
size->height > size->bounds_height)
|
||||
g_warning ("GdkToplevelSize: size exceeds bounds");
|
||||
|
||||
if (size->min_width > size->width ||
|
||||
size->min_height > size->height)
|
||||
g_warning ("GdkToplevelSize: min_size exceeds size");
|
||||
}
|
||||
|
@ -36,4 +36,6 @@ void gdk_toplevel_size_init (GdkToplevelSize *size,
|
||||
int bounds_width,
|
||||
int bounds_height);
|
||||
|
||||
void gdk_toplevel_size_validate (GdkToplevelSize *size);
|
||||
|
||||
#endif /* __GDK_TOPLEVEL_SIZE_PRIVATE_H__ */
|
||||
|
@ -4272,26 +4272,26 @@ toplevel_compute_size (GdkToplevel *toplevel,
|
||||
GtkWindowGeometryInfo *info;
|
||||
int width, height;
|
||||
GtkBorder shadow;
|
||||
int bounds_width, bounds_height;
|
||||
int default_width, default_height;
|
||||
int min_width, min_height;
|
||||
|
||||
info = gtk_window_get_geometry_info (window, FALSE);
|
||||
|
||||
gdk_toplevel_size_get_bounds (size, &bounds_width, &bounds_height);
|
||||
|
||||
gtk_window_compute_default_size (window,
|
||||
bounds_width, bounds_height,
|
||||
&default_width, &default_height);
|
||||
|
||||
if (priv->need_default_size)
|
||||
{
|
||||
int remembered_width;
|
||||
int remembered_height;
|
||||
int bounds_width;
|
||||
int bounds_height;
|
||||
|
||||
gdk_toplevel_size_get_bounds (size, &bounds_width, &bounds_height);
|
||||
|
||||
gtk_window_compute_default_size (window,
|
||||
bounds_width, bounds_height,
|
||||
&width, &height);
|
||||
gtk_window_get_remembered_size (window,
|
||||
&remembered_width, &remembered_height);
|
||||
width = MAX (width, remembered_width);
|
||||
height = MAX (height, remembered_height);
|
||||
width = MAX (default_width, remembered_width);
|
||||
height = MAX (default_height, remembered_height);
|
||||
|
||||
/* Override with default size */
|
||||
if (info)
|
||||
@ -4306,9 +4306,9 @@ toplevel_compute_size (GdkToplevel *toplevel,
|
||||
INCLUDE_CSD_SIZE);
|
||||
|
||||
if (info->default_width > 0)
|
||||
width = default_width_csd;
|
||||
width = min_width = default_width_csd;
|
||||
if (info->default_height > 0)
|
||||
height = default_height_csd;
|
||||
height = min_height = default_height_csd;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -4348,8 +4348,8 @@ toplevel_compute_size (GdkToplevel *toplevel,
|
||||
|
||||
get_shadow_width (window, &shadow);
|
||||
|
||||
min_width = width + shadow.left + shadow.right;
|
||||
min_height = height + shadow.top + shadow.bottom;
|
||||
min_width = MIN (default_width + shadow.left + shadow.right, width);
|
||||
min_height = MIN (default_height + shadow.top + shadow.bottom, height);
|
||||
gdk_toplevel_size_set_min_size (size, min_width, min_height);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user