[gtk/resizing-fixes] toplevelsize: Add shadow size
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/resizing-fixes] toplevelsize: Add shadow size
- Date: Wed, 12 Aug 2020 12:01:13 +0000 (UTC)
commit ece755ff623805429f8abf8d5063e32c765d5cf7
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Aug 12 07:59:16 2020 -0400
toplevelsize: Add shadow size
Setting the shadow together with the size makes
sense, since the shadow is needed to make sense
of the size.
gdk/gdktoplevelsize.c | 28 ++++++++++++++++++++++++++++
gdk/gdktoplevelsize.h | 6 ++++++
gdk/gdktoplevelsizeprivate.h | 5 +++++
3 files changed, 39 insertions(+)
---
diff --git a/gdk/gdktoplevelsize.c b/gdk/gdktoplevelsize.c
index 276e63f951..1b100223af 100644
--- a/gdk/gdktoplevelsize.c
+++ b/gdk/gdktoplevelsize.c
@@ -118,6 +118,31 @@ gdk_toplevel_size_set_min_size (GdkToplevelSize *size,
size->min_height = min_height;
}
+/**
+ * gdk_toplevel_size_set_shadow_size:
+ * @size: a #GdkToplevelSize
+ * @left: The left extent
+ * @right: The right extent
+ * @top: The top extent
+ * @bottom: The bottom extent
+ *
+ * Determine the size of the shadow and border area that should be
+ * considered “outside” for the purposes of window placement and
+ * edge snapping.
+ */
+void
+gdk_toplevel_size_set_shadow_size (GdkToplevelSize *size,
+ int left,
+ int right,
+ int top,
+ int bottom)
+{
+ size->shadow_left = left;
+ size->shadow_right = right;
+ size->shadow_top = top;
+ size->shadow_bottom = bottom;
+}
+
void
gdk_toplevel_size_validate (GdkToplevelSize *size)
{
@@ -132,4 +157,7 @@ gdk_toplevel_size_validate (GdkToplevelSize *size)
if (size->min_width > size->width ||
size->min_height > size->height)
g_warning ("GdkToplevelSize: min_size exceeds size");
+
+ if (size->width <= 0 || size->height <= 0)
+ g_warning ("GdkToplevelSize: size can't be zero");
}
diff --git a/gdk/gdktoplevelsize.h b/gdk/gdktoplevelsize.h
index 013a061ee9..22ec86ef5a 100644
--- a/gdk/gdktoplevelsize.h
+++ b/gdk/gdktoplevelsize.h
@@ -54,6 +54,12 @@ void gdk_toplevel_size_set_min_size (GdkToplevelSize *
int min_width,
int min_height);
+GDK_AVAILABLE_IN_ALL
+void gdk_toplevel_size_set_shadow_size (GdkToplevelSize *size,
+ int left,
+ int right,
+ int top,
+ int bottom);
G_END_DECLS
#endif /* __GDK_TOPLEVEL_SIZE_H__ */
diff --git a/gdk/gdktoplevelsizeprivate.h b/gdk/gdktoplevelsizeprivate.h
index 3576513888..2f773a3783 100644
--- a/gdk/gdktoplevelsizeprivate.h
+++ b/gdk/gdktoplevelsizeprivate.h
@@ -30,6 +30,11 @@ struct _GdkToplevelSize
int height;
int min_width;
int min_height;
+
+ int shadow_left;
+ int shadow_right;
+ int shadow_top;
+ int shadow_bottom;
};
void gdk_toplevel_size_init (GdkToplevelSize *size,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]