Check sanity of toplevel sizes

Emit a warning when sizes returned in GdkToplevelSize
don't look sane. This is the case in the failing
reftest.
This commit is contained in:
Matthias Clasen 2020-08-07 12:45:19 -04:00
parent 658719a205
commit a95012caa3
3 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -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");
}

View File

@ -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__ */