From e26cd958a03e318ae3e7d4623237d063f264a645 Mon Sep 17 00:00:00 2001 From: Liu Date: Sat, 21 Nov 2026 14:45:27 +0800 Subject: [PATCH] fix(ptk): emit window size event synchronously on Windows Hidden windows may not receive WM_SIZE, so the gallery native resize tests saw stale root sizes. Emit PTK_EVENT_SIZE with the requested client size, matching the X11 backend. --- lib/ptk/src/windows/win32app.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ptk/src/windows/win32app.c b/lib/ptk/src/windows/win32app.c index 46aa7d24..25dfe0f2 100644 --- a/lib/ptk/src/windows/win32app.c +++ b/lib/ptk/src/windows/win32app.c @@ -697,6 +697,7 @@ void ptk_window_set_size(ptk_window_t *wnd, int width, int height) { int client_width = width; int client_height = height; + ptk_event_t e = { 0 }; if (wnd->width == width && wnd->height == height) { return; @@ -709,6 +710,12 @@ void ptk_window_set_size(ptk_window_t *wnd, int width, int height) * must not observe the previous value. */ wnd->width = client_width; wnd->height = client_height; + /* Hidden windows may not receive WM_SIZE, so notify listeners now. */ + e.type = PTK_EVENT_SIZE; + e.window = wnd; + e.size.width = client_width; + e.size.height = client_height; + ptk_process_event(&e); } void ptk_window_show(ptk_window_t *wnd)