From b44d556351ea120c5b7910393c915626dc1f9720 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sat, 28 Mar 2026 09:58:43 +0100 Subject: [PATCH] =?UTF-8?q?wayland:=20Phase=2074=20=E2=80=94=20frame=20NUL?= =?UTF-8?q?L=20guards=20in=20window.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wWindowConfigure: add early-return Wayland path that dispatches client_synth_configure via vtable and updates client geometry instead of trying to configure a non-existent X11 frame window. wWindowSingleFocus: use client dimensions when frame is NULL for the wScreenBringInside call. wWindowSaveState: fall back to client width/height when frame is NULL (non-maximized path). Co-Authored-By: Claude Sonnet 4.6 --- src/window.c | 24 +++++++++++++++++++++--- tests/wl-smoke-test.sh | 4 ++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/window.c b/src/window.c index 509ecb6..e6f4775 100644 --- a/src/window.c +++ b/src/window.c @@ -1687,7 +1687,11 @@ void wWindowSingleFocus(WWindow *wwin) y = wwin->frame_y; /* bring window back to visible area */ - move = wScreenBringInside(scr, &x, &y, wwin->frame->core->width, wwin->frame->core->height); + { + int fw = wwin->frame ? (int)wwin->frame->core->width : (int)wwin->client.width; + int fh = wwin->frame ? (int)wwin->frame->core->height : (int)wwin->client.height; + move = wScreenBringInside(scr, &x, &y, fw, fh); + } if (move) wWindowConfigure(wwin, x, y, wwin->client.width, wwin->client.height); @@ -1948,6 +1952,19 @@ void wWindowConfigure(WWindow *wwin, int req_x, int req_y, int req_width, int re int synth_notify = False; int resize; + if (!wwin->frame) { + /* Phase 74: Wayland — no X11 frame; request resize via vtable and update geometry */ + wwin->frame_x = req_x; + wwin->frame_y = req_y; + wwin->client.x = req_x; + wwin->client.y = req_y; + wm_backend->client_synth_configure(wwin->client_win, req_x, req_y, req_width, req_height, 0, WNATIVE_NONE); + wwin->client.width = req_width; + wwin->client.height = req_height; + wWindowSynthConfigureNotify(wwin); + return; + } + resize = (req_width != wwin->client.width || req_height != wwin->client.height); if (WFLAGP(wwin, dont_move_off)) @@ -2248,8 +2265,9 @@ void wWindowSaveState(WWindow *wwin) if (wwin->flags.maximized == 0) { data[5] = wwin->frame_x; data[6] = wwin->frame_y; - data[7] = wwin->frame->core->width; - data[8] = wwin->frame->core->height; + /* Phase 74: Wayland windows have no frame; fall back to client size */ + data[7] = wwin->frame ? wwin->frame->core->width : wwin->client.width; + data[8] = wwin->frame ? wwin->frame->core->height : wwin->client.height; } else { data[5] = wwin->old_geometry.x; data[6] = wwin->old_geometry.y; diff --git a/tests/wl-smoke-test.sh b/tests/wl-smoke-test.sh index 9561b83..73e6fd3 100755 --- a/tests/wl-smoke-test.sh +++ b/tests/wl-smoke-test.sh @@ -81,6 +81,10 @@ # winmenu.c (OpenWindowMenu, execWindowOptionCommand, updateOptionsMenu) # so Wayland windows do not crash on frame->core stacking access # (build-only check). +# 32. (Phase 74) Frame NULL guards in window.c: wWindowConfigure dispatches +# client_synth_configure for Wayland windows; wWindowSingleFocus and +# wWindowSaveState use client geometry fallback when frame is NULL +# (build-only check). # # This test grows as wl_backend vtable slots are implemented. #