diff --git a/crates/kas-core/src/app/window.rs b/crates/kas-core/src/app/window.rs index 3cee764c1..3c71b9faf 100644 --- a/crates/kas-core/src/app/window.rs +++ b/crates/kas-core/src/app/window.rs @@ -39,6 +39,7 @@ struct WindowData> { theme_window: T::Window, next_avail_frame_time: Instant, queued_frame_time: Option, + is_sized: bool, } /// Per-window data @@ -192,6 +193,7 @@ impl> Window { theme_window, next_avail_frame_time: time, queued_frame_time: Some(time), + is_sized: apply_size, }); if apply_size { @@ -243,6 +245,7 @@ impl> Window { // NOTE: we could try resizing here in case the window is too // small due to non-linear scaling, but it appears unnecessary. window.solve_cache.invalidate_rule_cache(); + window.is_sized = false; false } WindowEvent::RedrawRequested => self.do_draw(state).is_err(), @@ -450,6 +453,7 @@ impl> Window { window.set_max_inner_size(Some(ideal)); }; + window.is_sized = true; window.set_visible(true); window.request_redraw(); log::trace!( @@ -467,6 +471,10 @@ impl> Window { let Some(ref mut window) = self.window else { return Ok(()); }; + if !window.is_sized { + log::debug!("Ignoring redraw request before window is (re)sized."); + return Err(()); + } window.next_avail_frame_time = start + self.ev_state.config().frame_dur();