From 7734929cd5b52bc7cf67ee21aa6c1f6afa202bb4 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sat, 28 Mar 2026 09:50:02 +0100 Subject: [PATCH] =?UTF-8?q?wayland:=20Phase=2071=20=E2=80=94=20early-retur?= =?UTF-8?q?n=20guards=20in=20major=20action=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add if (!wwin->frame) return guards to wShadeWindow, wUnshadeWindow, wMaximizeWindow, wUnmaximizeWindow, wFullscreenWindow, wIconifyWindow, and wDeiconifyWindow so that Wayland-managed windows (frame==NULL) do not crash when these actions are triggered via menu or keyboard shortcut. Co-Authored-By: Claude Sonnet 4.6 --- src/actions.c | 16 ++++++++++++++++ tests/wl-smoke-test.sh | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/src/actions.c b/src/actions.c index 31fbc5d..ed393a7 100644 --- a/src/actions.c +++ b/src/actions.c @@ -244,6 +244,8 @@ void wShadeWindow(WWindow *wwin) if (wwin->flags.shaded) return; + if (!wwin->frame) + return; /* Phase 71: Wayland — no frame to shade */ wm_backend->stacking_lower(wwin->client_win); shade_animate(wwin, SHADE); @@ -281,6 +283,8 @@ void wUnshadeWindow(WWindow *wwin) if (!wwin->flags.shaded) return; + if (!wwin->frame) + return; /* Phase 71: Wayland — no frame to unshade */ wwin->flags.shaded = 0; wwin->flags.mapped = 1; @@ -374,6 +378,8 @@ void wMaximizeWindow(WWindow *wwin, int directions, int head) if (!IS_RESIZABLE(wwin)) return; + if (!wwin->frame) + return; /* Phase 71: Wayland — no frame for maximize geometry */ if (!HAS_BORDER(wwin)) has_border = 0; @@ -926,6 +932,8 @@ void wUnmaximizeWindow(WWindow *wwin) if (!wwin->flags.maximized) return; + if (!wwin->frame) + return; /* Phase 71: Wayland — no frame to unmaximize */ if (wwin->flags.shaded) { wwin->flags.skip_next_animation = 1; @@ -1007,6 +1015,8 @@ void wFullscreenWindow(WWindow *wwin) if (wwin->flags.fullscreen) return; + if (!wwin->frame) + return; /* Phase 71: Wayland — no frame for fullscreen */ wwin->flags.fullscreen = True; @@ -1402,6 +1412,8 @@ void wIconifyWindow(WWindow *wwin) if (owner && owner->flags.miniaturized) return; } + if (!wwin->frame) + return; /* Phase 71: Wayland — no frame for iconify */ present = WIN_WORKSPACE(wwin) == wwin->screen_ptr->current_workspace; @@ -1552,6 +1564,10 @@ void wDeiconifyWindow(WWindow *wwin) w_global.ignore_workspace_change = False; return; } + if (!wwin->frame) { + w_global.ignore_workspace_change = False; + return; /* Phase 71: Wayland — no frame for deiconify */ + } if (wwin->transient_for != WNATIVE_NONE && wwin->transient_for != wwin->screen_ptr->root_win) { WWindow *owner = recursiveTransientFor(wwin); diff --git a/tests/wl-smoke-test.sh b/tests/wl-smoke-test.sh index 983e524..2bb9212 100755 --- a/tests/wl-smoke-test.sh +++ b/tests/wl-smoke-test.sh @@ -67,6 +67,10 @@ # 28. (Phase 70) WIN_WORKSPACE macro applied to remaining frame->workspace # reads in actions.c, cycling.c, event.c, moveres.c, placement.c, # switchpanel.c, wmspec.c, workspace.c; write sites keep direct access. +# 29. (Phase 71) Early-return guards added to wShadeWindow, wUnshadeWindow, +# wMaximizeWindow, wUnmaximizeWindow, wFullscreenWindow, wIconifyWindow, +# wDeiconifyWindow so that Wayland windows (frame==NULL) do not crash +# when these actions are triggered (build-only check). # # This test grows as wl_backend vtable slots are implemented. #