aboutsummaryrefslogtreecommitdiff
path: root/rt/src
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2026-01-04 19:30:53 -0700
committerJosh Rahm <joshuarahm@gmail.com>2026-01-04 19:31:16 -0700
commit235de32e3b4d0ae8de984a29af9d6233c1ed1080 (patch)
tree4dcd18c2d884b0db05b9942bb40a12f8227229d3 /rt/src
parentefe34b2c98cc90ed686217ea3b0655fae1839414 (diff)
downloadmontis-235de32e3b4d0ae8de984a29af9d6233c1ed1080.tar.gz
montis-235de32e3b4d0ae8de984a29af9d6233c1ed1080.tar.bz2
montis-235de32e3b4d0ae8de984a29af9d6233c1ed1080.zip
[feat] Request that clients don't draw their decorations.
Diffstat (limited to 'rt/src')
-rw-r--r--rt/src/wl.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/rt/src/wl.c b/rt/src/wl.c
index 7c24168..af348f3 100644
--- a/rt/src/wl.c
+++ b/rt/src/wl.c
@@ -822,6 +822,41 @@ static void server_new_xdg_popup(struct wl_listener *listener, void *data)
wl_signal_add(&xdg_popup->events.destroy, &popup->destroy);
}
+static void xdg_decoration_request_mode(struct wl_listener *listener,
+ void *data)
+{
+ /* Clients can request a decoration mode; we always enforce server-side. */
+ struct montis_xdg_decoration *dec =
+ wl_container_of(listener, dec, request_mode);
+ wlr_xdg_toplevel_decoration_v1_set_mode(
+ dec->decoration, WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
+}
+
+static void xdg_decoration_destroy(struct wl_listener *listener, void *data)
+{
+ struct montis_xdg_decoration *dec =
+ wl_container_of(listener, dec, destroy);
+ wl_list_remove(&dec->request_mode.link);
+ wl_list_remove(&dec->destroy.link);
+ free(dec);
+}
+
+static void server_new_xdg_decoration(struct wl_listener *listener, void *data)
+{
+ /* Force server-side decorations to disable client-side frames. */
+ struct wlr_xdg_toplevel_decoration_v1 *decoration = data;
+ struct montis_xdg_decoration *dec = calloc(1, sizeof(*dec));
+ dec->decoration = decoration;
+
+ dec->request_mode.notify = xdg_decoration_request_mode;
+ wl_signal_add(&decoration->events.request_mode, &dec->request_mode);
+ dec->destroy.notify = xdg_decoration_destroy;
+ wl_signal_add(&decoration->events.destroy, &dec->destroy);
+
+ wlr_xdg_toplevel_decoration_v1_set_mode(
+ decoration, WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
+}
+
static void xdg_toplevel_commit(struct wl_listener *listener, void *data)
{
/* Called when a new surface state is committed. */
@@ -992,6 +1027,16 @@ int main(int argc, char *argv[])
server.new_xdg_popup.notify = server_new_xdg_popup;
wl_signal_add(&server.xdg_shell->events.new_popup, &server.new_xdg_popup);
+ /* Request server-side decorations for xdg-toplevel surfaces. */
+ server.xdg_decoration_manager =
+ wlr_xdg_decoration_manager_v1_create(server.wl_display);
+ if (server.xdg_decoration_manager != NULL) {
+ server.new_xdg_decoration.notify = server_new_xdg_decoration;
+ wl_signal_add(
+ &server.xdg_decoration_manager->events.new_toplevel_decoration,
+ &server.new_xdg_decoration);
+ }
+
/*
* Creates a cursor, which is a wlroots utility for tracking the cursor
* image shown on screen.