From cf5541350e58981ea7a7127594eba0c7f2f6a32c Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 14:27:53 +0000 Subject: [PATCH] gpui(windows): Force a paint message when running out foreground budget (#46609) (cherry-pick to preview) (#46622) Cherry-pick of #46609 to preview ---- Release Notes: - Fixed zed no longer rendering on windows in a timely manner if it gets overloaded with foreground work Co-authored-by: John Tur Co-authored-by: Lukas Wirth Co-authored-by: John Tur --- crates/gpui/src/platform/windows/platform.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/gpui/src/platform/windows/platform.rs b/crates/gpui/src/platform/windows/platform.rs index 7b86a9ab876a275a217b13a9b2ca22ef7d0fc982..ef4722173ebd4e411cf30d796995e9a72cc65f3f 100644 --- a/crates/gpui/src/platform/windows/platform.rs +++ b/crates/gpui/src/platform/windows/platform.rs @@ -838,6 +838,11 @@ impl WindowsPlatformInner { let peek_msg = |msg: &mut _, msg_kind| unsafe { PeekMessageW(msg, None, 0, 0, PM_REMOVE | msg_kind).as_bool() }; + // We need to process a paint message here as otherwise we will re-enter `run_foreground_task` before painting if we have work remaining. + // The reason for this is that windows prefers custom application message processing over system messages. + if peek_msg(&mut msg, PM_QS_PAINT) { + process_message(&msg); + } while peek_msg(&mut msg, PM_QS_INPUT) { process_message(&msg); }