From a61c199d5e8b5940de8d4caee583030783bcdedd Mon Sep 17 00:00:00 2001 From: IoIxD Date: Sun, 27 Sep 2026 19:26:52 -0700 Subject: [PATCH] MwLLWaylandSetToolWindowType --- include/Mw/LowLevel/Wayland.h | 11 +++++++++++ src/backend/wayland/wayland.c | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/Mw/LowLevel/Wayland.h b/include/Mw/LowLevel/Wayland.h index c49af026..e94ed950 100644 --- a/include/Mw/LowLevel/Wayland.h +++ b/include/Mw/LowLevel/Wayland.h @@ -464,6 +464,8 @@ struct _MwLLWayland { MwBool accepts_dnd; MwBool shown; + + enum zwlr_layer_shell_v1_layer layer_surface_type; }; struct _MwLLWaylandColor { @@ -526,4 +528,13 @@ typedef struct zxdg_decoration_manager_v1_context { extern struct zwp_relative_pointer_v1_listener MwLLWaylandRelativePointerListener; +/* + * function for setting the layer surface type used when creating a tool window + * (assuming layer surfaces are used). + * + * NOTE: Must be called after MwLLMakeToolWindow, as that function sets the type to + * the default of ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY. + */ +MWDECL void MWAPI MwLLWaylandSetToolWindowType(MwLL handle, enum zwlr_layer_shell_v1_layer type); + #endif diff --git a/src/backend/wayland/wayland.c b/src/backend/wayland/wayland.c index f5f3e283..fb8cb020 100644 --- a/src/backend/wayland/wayland.c +++ b/src/backend/wayland/wayland.c @@ -725,7 +725,7 @@ static void setup_layer_surface(MwLL r, int x, int y, int width, int height) { r->wayland.framebuffer.surface = wl_compositor_create_surface(r->wayland.compositor); - r->wayland.layer_surface->surface = zwlr_layer_shell_v1_get_layer_surface(layer_shell, r->wayland.framebuffer.surface, NULL, ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, "milsko-surfaces"); + r->wayland.layer_surface->surface = zwlr_layer_shell_v1_get_layer_surface(layer_shell, r->wayland.framebuffer.surface, NULL, r->wayland.layer_surface_type, "milsko-surfaces"); zwlr_layer_surface_v1_set_size(r->wayland.layer_surface->surface, width, height); zwlr_layer_surface_v1_set_margin(r->wayland.layer_surface->surface, @@ -1873,9 +1873,15 @@ static void MwLLMakeToolWindowImpl(MwLL handle) { handle->wayland.type_to_be = MwLL_WAYLAND_POPUP; } + handle->wayland.layer_surface_type = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; + handle->wayland.changing = MwTRUE; } +MWDECL void MWAPI MwLLWaylandSetToolWindowType(MwLL handle, enum zwlr_layer_shell_v1_layer type) { + handle->wayland.layer_surface_type = type; +} + static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) { MwLL topmost_parent = handle;