ZIm/crates/gpui/src
张小白 b62f959528
windows: Fix message loop using too much CPU (#35969)
Closes #34374

This is a leftover issue from #34374. Back in #34374, I wanted to use
DirectX to handle vsync, after all, that’s how 99% of Windows apps do
it. But after discussing with @maxbrunsfeld , we decided to stick with
the original vsync approach given gpui’s architecture.

In my tests, there’s no noticeable performance difference between this
PR’s approach and DirectX vsync. That said, this PR’s method does have a
theoretical advantage, it doesn’t block the main thread while waiting
for vsync.


The only difference is that in this PR, on Windows 11 we use a newer API
instead of `DwmFlush`, since Chrome’s tests have shown that `DwmFlush`
has some problems. This PR also removes the use of
`MsgWaitForMultipleObjects`.


Release Notes:

- N/A

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2025-08-12 11:28:47 -07:00
..
app Add an editor: diff clipboard with selection action (#33283) 2025-07-23 02:39:32 +00:00
elements Simplify ListState API (#35685) 2025-08-06 00:02:26 +00:00
keymap Revert "Revert "chore: Bump Rust to 1.89 (#35788)"" (#35937) 2025-08-09 23:48:58 +02:00
platform windows: Fix message loop using too much CPU (#35969) 2025-08-12 11:28:47 -07:00
text_system Improve terminal rendering performance (#33345) 2025-07-08 09:05:01 -06:00
window gpui: Improve window.prompt to support ESC with non-English cancel text on macOS (#29538) 2025-05-30 15:26:27 +00:00
action.rs gpui: Reduce manual shifting & other minor improvements (#34407) 2025-07-15 16:39:33 +02:00
app.rs client: Send User-Agent header on WebSocket connection requests (#35280) 2025-07-29 16:53:56 +00:00
arena.rs chore: Bump Rust version to 1.88 (#33439) 2025-06-26 20:54:19 +02:00
asset_cache.rs gpui: Relax AssetLogger trait bounds (#29450) 2025-04-29 12:43:54 -07:00
assets.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
bounds_tree.rs gpui: Optimize the ordering update in the BoundsTree (#31025) 2025-05-30 08:23:27 -07:00
color.rs Rasterize glyphs without D2D (#35376) 2025-08-01 19:46:09 +02:00
colors.rs gpui: Add a standard text example (#30747) 2025-05-16 17:35:44 +02:00
element.rs gpui: Add use state APIs (#34741) 2025-07-19 01:27:54 +00:00
executor.rs Add a test for remote tool use by the agent (#30289) 2025-05-08 16:53:04 -04:00
geometry.rs onboarding: Go back to not having system be separate (#35499) 2025-08-04 17:56:56 -04:00
global.rs Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
gpui.rs gpui: Add tab focus support (#33008) 2025-07-20 16:38:54 -07:00
input.rs Implement character index for point (#23989) 2025-02-04 20:15:43 +00:00
inspector.rs Add a live Rust style editor to inspector to edit a sequence of no-argument style modifiers (#31443) 2025-05-26 17:43:57 +00:00
interactive.rs gpui: Impl Default for ClickEvent (#35751) 2025-08-06 23:24:37 -04:00
key_dispatch.rs Fix keys not being sent to terminal (#35979) 2025-08-11 09:07:32 -06:00
keymap.rs gpui: Simplify bindings_for_action API (#34857) 2025-07-22 10:59:51 -04:00
path_builder.rs Revert "gpui: Improve path rendering & global multisample anti-aliasing" (#34722) 2025-07-18 16:03:08 +00:00
platform.rs windows: Port to DirectX 11 (#34374) 2025-07-30 15:27:58 -07:00
prelude.rs Sketch in a table for the keybindings UI (#32436) 2025-06-30 19:25:11 -04:00
scene.rs Fix underline flickering (#35989) 2025-08-11 19:17:48 +02:00
shared_string.rs Migrate to schemars version 1.0 (#33635) 2025-06-30 21:07:28 +00:00
shared_uri.rs Rework loading images from files (#7088) 2024-01-30 11:26:02 -05:00
style.rs Add a live Rust style editor to inspector to edit a sequence of no-argument style modifiers (#31443) 2025-05-26 17:43:57 +00:00
styled.rs Add a live Rust style editor to inspector to edit a sequence of no-argument style modifiers (#31443) 2025-05-26 17:43:57 +00:00
subscription.rs gpui: Replace Mutex with RefCell for SubscriberSet (#30907) 2025-05-19 11:08:04 +02:00
svg_renderer.rs gpui: Use static keyword with LazyLock when loading system fonts (#34555) 2025-07-18 12:35:38 +02:00
tab_stop.rs gpui: Ensure first tab index is selected on first focus (#35247) 2025-07-29 10:30:38 +00:00
taffy.rs Re-land taffy 0.8.3 (#34939) 2025-07-24 00:33:43 +02:00
test.rs Add seed argument to #[gpui::test] attribute macro (#26764) 2025-03-14 13:40:02 -03:00
text_system.rs Improve terminal rendering performance (#33345) 2025-07-08 09:05:01 -06:00
util.rs chore: Bump Rust version to 1.88 (#33439) 2025-06-26 20:54:19 +02:00
view.rs Add initial element inspector for Zed development (#31315) 2025-05-23 23:08:59 +00:00
window.rs Fix underline flickering (#35989) 2025-08-11 19:17:48 +02:00