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.
This commit is contained in:
Jonas Ådahl 2020-11-24 15:51:56 +01:00
parent e07fde5c81
commit 13b4a4b24c
4 changed files with 36 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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