From 292ffe1120a65a57f13b7576aa1132dbbbc0c7f9 Mon Sep 17 00:00:00 2001 From: IoIxD Date: Fri, 11 Sep 2026 13:38:58 -0700 Subject: [PATCH] more robust mw_force_csd --- src/backend/wayland/wayland.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/backend/wayland/wayland.c b/src/backend/wayland/wayland.c index 6d34e49..82c053e 100644 --- a/src/backend/wayland/wayland.c +++ b/src/backend/wayland/wayland.c @@ -171,10 +171,6 @@ static void xdg_toplevel_configure(void* data, if(width == 0 || height == 0) { width = self->wayland.ww; height = self->wayland.wh; - /* if it's still 0 then bail */ - if(width == 0 || height == 0) { - return; - } } if(self->wayland.type == MwLL_WAYLAND_TOPLEVEL) { @@ -257,6 +253,7 @@ void MwLLWaylandBufferUpdate(MwLL self, struct _MwLLWaylandShmBuffer* buffer) { /* Toplevel setup function */ static void setup_toplevel(MwLL r, int x, int y) { + char* mw_force_csd = getenv("MW_FORCE_CSD"); r->wayland.type = MwLL_WAYLAND_TOPLEVEL; r->wayland.toplevel = malloc(sizeof(struct _MwLLWaylandTopLevel)); r->wayland.x = x; @@ -284,7 +281,10 @@ static void setup_toplevel(MwLL r, int x, int y) { } /* check now if we have decorations so that everything else can act accordingly */ - if(shget(r->wayland.wl_protocol_map, zxdg_decoration_manager_v1_interface.name) != NULL && getenv("MW_FORCE_CSD") == NULL) { + if(mw_force_csd != NULL) { + r->wayland.has_decorations = strcmp(mw_force_csd, "0") == 0; + r->wayland.do_csd = strcmp(mw_force_csd, "1") == 0; + } else if(shget(r->wayland.wl_protocol_map, zxdg_decoration_manager_v1_interface.name) != NULL) { r->wayland.has_decorations = MwTRUE; } else { r->wayland.do_csd = MwTRUE; @@ -492,11 +492,12 @@ struct xdg_popup_listener popup_listener = { /* Popup setup function */ static void setup_popup(MwLL r, int x, int y, MwLL parent) { - MwLL topmost_parent = r->wayland.parent; - r->wayland.type = MwLL_WAYLAND_POPUP; - r->wayland.x = x; - r->wayland.y = y; - r->wayland.popup = malloc(sizeof(struct _MwLLWaylandPopup)); + char* mw_force_csd = getenv("MW_FORCE_CSD"); + MwLL topmost_parent = r->wayland.parent; + r->wayland.type = MwLL_WAYLAND_POPUP; + r->wayland.x = x; + r->wayland.y = y; + r->wayland.popup = malloc(sizeof(struct _MwLLWaylandPopup)); if(parent) { MwWidget p = parent->common.user; @@ -527,7 +528,10 @@ static void setup_popup(MwLL r, int x, int y, MwLL parent) { } /* check now if we have decorations so that everything else can act accordingly */ - if(shget(r->wayland.wl_protocol_map, zxdg_decoration_manager_v1_interface.name) != NULL && getenv("MW_FORCE_CSD") == NULL) { + if(mw_force_csd != NULL) { + r->wayland.has_decorations = strcmp(mw_force_csd, "0") == 0; + r->wayland.do_csd = strcmp(mw_force_csd, "1") == 0; + } else if(shget(r->wayland.wl_protocol_map, zxdg_decoration_manager_v1_interface.name) != NULL) { r->wayland.has_decorations = MwTRUE; } else { r->wayland.do_csd = MwTRUE;