[gtk/matthiasc/surface-state-rework: 13/80] gdk/toplevelsize: Add way to set margin
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/surface-state-rework: 13/80] gdk/toplevelsize: Add way to set margin
- Date: Sat, 5 Dec 2020 17:42:38 +0000 (UTC)
commit a60eb215c5e4d9a4643c7833f7b214448a24e247
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Nov 24 15:51:56 2020 +0100
gdk/toplevelsize: Add way to set margin
Will be used to communicate the shadow margin, instead of using
gdk_surface_set_shadow_width().
Also set these values in gtkwindow.c.
gdk/gdktoplevelsize.c | 14 ++++++++++++++
gdk/gdktoplevelsize.h | 7 +++++++
gdk/gdktoplevelsizeprivate.h | 8 ++++++++
gtk/gtkwindow.c | 7 +++++++
4 files changed, 36 insertions(+)
---
diff --git a/gdk/gdktoplevelsize.c b/gdk/gdktoplevelsize.c
index e5802782d4..7cd09ebd5e 100644
--- a/gdk/gdktoplevelsize.c
+++ b/gdk/gdktoplevelsize.c
@@ -118,6 +118,20 @@ gdk_toplevel_size_set_min_size (GdkToplevelSize *size,
size->min_height = min_height;
}
+void
+gdk_toplevel_size_set_margin (GdkToplevelSize *size,
+ int left,
+ int right,
+ int top,
+ int bottom)
+{
+ size->margin.is_valid = TRUE;
+ size->margin.left = left;
+ size->margin.right = right;
+ size->margin.top = top;
+ size->margin.bottom = bottom;
+}
+
void
gdk_toplevel_size_validate (GdkToplevelSize *size)
{
diff --git a/gdk/gdktoplevelsize.h b/gdk/gdktoplevelsize.h
index 013a061ee9..41f8a4a604 100644
--- a/gdk/gdktoplevelsize.h
+++ b/gdk/gdktoplevelsize.h
@@ -54,6 +54,13 @@ void gdk_toplevel_size_set_min_size (GdkToplevelSize *
int min_width,
int min_height);
+GDK_AVAILABLE_IN_ALL
+void gdk_toplevel_size_set_margin (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..f2c4461bf9 100644
--- a/gdk/gdktoplevelsizeprivate.h
+++ b/gdk/gdktoplevelsizeprivate.h
@@ -30,6 +30,14 @@ struct _GdkToplevelSize
int height;
int min_width;
int min_height;
+
+ struct {
+ gboolean is_valid;
+ int left;
+ int right;
+ int top;
+ int bottom;
+ } margin;
};
void gdk_toplevel_size_init (GdkToplevelSize *size,
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index fc2cd4a986..67c9d721ba 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -4364,6 +4364,13 @@ toplevel_compute_size (GdkToplevel *toplevel,
min_height = MIN (min_height + shadow.top + shadow.bottom, height);
gdk_toplevel_size_set_min_size (size, min_width, min_height);
+
+ if (priv->use_client_shadow)
+ {
+ gdk_toplevel_size_set_margin (size,
+ shadow.left, shadow.right,
+ shadow.top, shadow.bottom);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]