From 65a5a2f6ffc6f67ffa3d5ee62b3c8979b4c35b7a Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Fri, 16 Oct 2026 14:29:14 +0300 Subject: Report the current geometry in WINDOW events During a macOS live resize, the refresh callback ran with the new size while its WINDOW event stayed queued until the drag ended. wsap_term sizes its grid from WINDOW events, so the grid kept its old size until the mouse was released. Every intermediate size then replayed in a burst, since queued resizes were never folded. A WINDOW event now reports the surface's current geometry, so resizes queued while the application was away fold into one, and a size it already has reports nothing. The refresh callback documents that yasl_surface_get_info is current inside it and that one WINDOW event follows once the system's loop returns. Co-Authored-By: Claude Opus 5.5 --- include/yasl/yasl.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/yasl/yasl.h b/include/yasl/yasl.h index 931cf7f..d68bcc9 100644 --- a/include/yasl/yasl.h +++ b/include/yasl/yasl.h @@ -81,7 +81,10 @@ struct yasl_surface_options { void *userdata; /** Called when the window needs drawing while the system blocks the event * loop, as during a macOS live resize; draw and present before returning. - * REFRESH events cover every other case. Must not wait, create or destroy. */ + * REFRESH events cover every other case. Events stay queued meanwhile, so + * apply the size from yasl_surface_get_info, already current here; one + * WINDOW event reports the final size once the system's loop returns. + * Waiting, creating and destroying fail with EBUSY. */ void (*refresh)(yasl_surface *surface); struct yasl_gl_options gl; }; @@ -201,7 +204,9 @@ enum yasl_event_type { YASL_EVENT_CLOSE, /**< The user asked to close the window; destroy it to comply. */ YASL_EVENT_QUIT, /**< The system asked the app to quit; exit to comply. */ YASL_EVENT_REOPEN, /**< macOS: the app was activated with no window open. */ - YASL_EVENT_WINDOW, /**< window: size, scale or state changed. */ + YASL_EVENT_WINDOW, /**< window: size, scale or state changed. It reports the + * current geometry, so changes made since the last + * one fold into it. */ YASL_EVENT_REFRESH, /**< Draw now: once sized, after every resize, and on expose. */ YASL_EVENT_KEY, /**< key; action is a yasl_key_action. */ YASL_EVENT_TEXT, /**< text: typed text to insert. */ -- cgit v1.2.3