xdg-shell: Add set_margin request
This is used to figure out the size of "invisible" decorations, which we'll
use to better know the visible extents of the surface, which we can use for
constraining, titlebars, and more.
diff --git a/clients/window.c b/clients/window.c
index 97cce1a..91c1ea0 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -3938,6 +3938,27 @@
}
static void
+window_sync_margin(struct window *window)
+{
+ int margin;
+
+ if (!window->xdg_surface)
+ return;
+
+ if (!window->frame)
+ return;
+
+ margin = frame_get_shadow_margin(window->frame->frame);
+
+ /* Shadow size is the same on every side. */
+ xdg_surface_set_margin(window->xdg_surface,
+ margin,
+ margin,
+ margin,
+ margin);
+}
+
+static void
window_flush(struct window *window)
{
struct surface *surface;
@@ -3953,6 +3974,7 @@
&xdg_surface_listener, window);
window_sync_transient_for(window);
+ window_sync_margin(window);
}
}