wayland: Phase 71 — early-return guards in major action functions

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 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-28 09:50:02 +01:00
parent c2c4f699f3
commit 7734929cd5
2 changed files with 20 additions and 0 deletions

View File

@ -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);

View File

@ -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.
#