[gtk/matthias/fix-min-size: 2/2] Check sanity of toplevel sizes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthias/fix-min-size: 2/2] Check sanity of toplevel sizes
- Date: Fri, 7 Aug 2020 16:47:07 +0000 (UTC)
commit a95012caa38057c7decdb6e4e94749e64a2528f8
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Aug 7 12:45:19 2020 -0400
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.
gdk/gdktoplevel.c | 1 +
gdk/gdktoplevelsize.c | 16 ++++++++++++++++
gdk/gdktoplevelsizeprivate.h | 2 ++
3 files changed, 19 insertions(+)
---
diff --git a/gdk/gdktoplevel.c b/gdk/gdktoplevel.c
index 3b8a22a611..a7802a3504 100644
--- a/gdk/gdktoplevel.c
+++ b/gdk/gdktoplevel.c
@@ -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
diff --git a/gdk/gdktoplevelsize.c b/gdk/gdktoplevelsize.c
index 18933523ff..276e63f951 100644
--- a/gdk/gdktoplevelsize.c
+++ b/gdk/gdktoplevelsize.c
@@ -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");
+}
diff --git a/gdk/gdktoplevelsizeprivate.h b/gdk/gdktoplevelsizeprivate.h
index eaddefba0b..3576513888 100644
--- a/gdk/gdktoplevelsizeprivate.h
+++ b/gdk/gdktoplevelsizeprivate.h
@@ -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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]