bevy/examples/window
Jan Hohenheim a750cfe4a1
Split CursorOptions off of Window (#19668)
# Objective

- Fixes #19627 
- Tackles part of #19644 
- Supersedes #19629
- `Window` has become a very very very big component
- As such, our change detection does not *really* work on it, as e.g.
moving the mouse will cause a change for the entire window
- We circumvented this with a cache
- But, some things *shouldn't* be cached as they can be changed from
outside the user's control, notably the cursor grab mode on web
- So, we need to disable the cache for that
- But because change detection is broken, that would result in the
cursor grab mode being set every frame the mouse is moved
- That is usually *not* what a dev wants, as it forces the cursor to be
locked even when the end-user is trying to free the cursor on the
browser
  - the cache in this situation is invalid due to #8949

## Solution

- Split `Window` into multiple components, each with working change
detection
- Disable caching of the cursor grab mode
- This will only attempt to force the grab mode when the `CursorOptions`
were touched by the user, which is *much* rarer than simply moving the
mouse.
- If this PR is merged, I'll do the exact same for the other
constituents of `Window` as a follow-up

## Testing

- Ran all the changed examples
2025-06-17 20:20:13 +00:00
..
clear_color.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
custom_cursor_image.rs Rename Timer::finished and Timer::paused to is_finished and is_paused (#19386) 2025-05-27 22:24:18 +00:00
custom_user_event.rs Event Split: Event, EntityEvent, and BufferedEvent (#19647) 2025-06-15 16:46:34 +00:00
low_power.rs Fix non-crate typos (#18219) 2025-03-11 06:17:48 +00:00
monitor_info.rs Rework WindowMode::Fullscreen API (#17525) 2025-03-11 01:20:53 +00:00
multiple_windows.rs extract_text_shadows camera query fix (#17930) 2025-03-10 21:22:14 +00:00
scale_factor_override.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
screenshot.rs simplify example, replace get_single to Single Query (#16187) 2024-11-01 18:25:42 +00:00
transparent_window.rs Migrate bevy_sprite to required components (#15489) 2024-10-09 16:17:26 +00:00
window_drag_move.rs Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
window_resizing.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
window_settings.rs Split CursorOptions off of Window (#19668) 2025-06-17 20:20:13 +00:00