From ca7f20e3945bf378ff486923da231339b63a4849 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Wed, 2 Apr 2025 15:55:50 -0700 Subject: [PATCH] detect window resizes as a layout-reset correctly --- src/raddbg/raddbg_core.c | 7 +++++-- src/raddbg/raddbg_core.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index c9b0870c..158d288d 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -9094,6 +9094,8 @@ rd_window_frame(void) //- rjf: @window_ui_part animate panels // { + B32 window_is_resizing = (ws->last_window_rect.x1 != window_rect.x1 || + ws->last_window_rect.y1 != window_rect.y1); Vec2F32 content_rect_dim = dim_2f32(content_rect); if(content_rect_dim.x > 0 && content_rect_dim.y > 0) { @@ -9106,7 +9108,7 @@ rd_window_frame(void) target_rect_px.y0/content_rect_dim.y, target_rect_px.x1/content_rect_dim.x, target_rect_px.y1/content_rect_dim.y); - B32 reset = (ws->window_layout_reset || ws->frames_alive < 5 || is_changing_panel_boundaries); + B32 reset = (window_is_resizing || ws->window_layout_reset || ws->frames_alive < 5 || is_changing_panel_boundaries); ui_anim(ui_key_from_stringf(ui_key_zero(), "panel_%p_x0", panel->cfg), target_rect_pct.x0, .initial = target_rect_pct.x0, .reset = reset); ui_anim(ui_key_from_stringf(ui_key_zero(), "panel_%p_y0", panel->cfg), target_rect_pct.y0, .initial = target_rect_pct.y0, .reset = reset); ui_anim(ui_key_from_stringf(ui_key_zero(), "panel_%p_x1", panel->cfg), target_rect_pct.x1, .initial = target_rect_pct.x1, .reset = reset); @@ -10387,9 +10389,10 @@ rd_window_frame(void) } ////////////////////////////// - //- rjf: @window_frame_part increment per-window frame counter + //- rjf: @window_frame_part update per-window frame counters/info // ws->frames_alive += 1; + ws->last_window_rect = os_client_rect_from_window(ws->os); ProfEnd(); scratch_end(scratch); diff --git a/src/raddbg/raddbg_core.h b/src/raddbg/raddbg_core.h index 568cdcb8..855445f8 100644 --- a/src/raddbg/raddbg_core.h +++ b/src/raddbg/raddbg_core.h @@ -527,6 +527,7 @@ struct RD_WindowState F32 last_dpi; B32 window_temporarily_focused_ipc; B32 window_layout_reset; + Rng2F32 last_window_rect; // rjf: theme (recomputed each frame) UI_Theme *theme;