bevy/crates
Pietro 061bee7e3c
fix: upgrade to winit v0.30 (#13366)
# Objective

- Upgrade winit to v0.30
- Fixes https://github.com/bevyengine/bevy/issues/13331

## Solution

This is a rewrite/adaptation of the new trait system described and
implemented in `winit` v0.30.

## Migration Guide

The custom UserEvent is now renamed as WakeUp, used to wake up the loop
if anything happens outside the app (a new
[custom_user_event](https://github.com/bevyengine/bevy/pull/13366/files#diff-2de8c0a8d3028d0059a3d80ae31b2bbc1cde2595ce2d317ea378fe3e0cf6ef2d)
shows this behavior.

The internal `UpdateState` has been removed and replaced internally by
the AppLifecycle. When changed, the AppLifecycle is sent as an event.

The `UpdateMode` now accepts only two values: `Continuous` and
`Reactive`, but the latter exposes 3 new properties to enable reactive
to device, user or window events. The previous `UpdateMode::Reactive` is
now equivalent to `UpdateMode::reactive()`, while
`UpdateMode::ReactiveLowPower` to `UpdateMode::reactive_low_power()`.

The `ApplicationLifecycle` has been renamed as `AppLifecycle`, and now
contains the possible values of the application state inside the event
loop:
* `Idle`: the loop has not started yet
* `Running` (previously called `Started`): the loop is running
* `WillSuspend`: the loop is going to be suspended
* `Suspended`: the loop is suspended
* `WillResume`: the loop is going to be resumed

Note: the `Resumed` state has been removed since the resumed app is just
running.

Finally, now that `winit` enables this, it extends the `WinitPlugin` to
support custom events.

## Test platforms

- [x] Windows
- [x] MacOs
- [x] Linux (x11)
- [x] Linux (Wayland)
- [x] Android
- [x] iOS
- [x] WASM/WebGPU
- [x] WASM/WebGL2

## Outstanding issues / regressions

- [ ] iOS: build failed in CI
   - blocking, but may just be flakiness
- [x] Cross-platform: when the window is maximised, changes in the scale
factor don't apply, to make them apply one has to make the window
smaller again. (Re-maximising keeps the updated scale factor)
    - non-blocking, but good to fix
- [ ] Android: it's pretty easy to quickly open and close the app and
then the music keeps playing when suspended.
    - non-blocking but worrying
- [ ]  Web: the application will hang when switching tabs
- Not new, duplicate of https://github.com/bevyengine/bevy/issues/13486
- [ ] Cross-platform?: Screenshot failure, `ERROR present_frames:
wgpu_core::present: No work has been submitted for this frame before`
taking the first screenshot, but after pressing space
    - non-blocking, but good to fix

---------

Co-authored-by: François <francois.mockers@vleue.com>
2024-06-03 13:06:48 +00:00
..
bevy_a11y fix: upgrade to winit v0.30 (#13366) 2024-06-03 13:06:48 +00:00
bevy_animation Remove ClampColor (#13307) 2024-05-10 13:15:56 +00:00
bevy_app Simplify state transitions (#13616) 2024-06-01 21:00:38 +00:00
bevy_asset Improvement of AssetServer::load documentation to help find a way to load from file with hash in filename (#13272) 2024-06-03 12:54:29 +00:00
bevy_audio Update to rodio 0.18 (#13612) 2024-06-02 14:25:51 +00:00
bevy_color Added a Grey trait, and implementations on baked-in colors. Fixes #13206 (#13237) 2024-05-26 12:53:50 +00:00
bevy_core Determine msrv for every standalone bevy_* crate. (#13211) 2024-05-13 18:26:41 +00:00
bevy_core_pipeline Add Skybox Motion Vectors (#13617) 2024-06-02 16:09:28 +00:00
bevy_derive Deprecate dynamic plugins (#13080) 2024-05-20 20:01:28 +00:00
bevy_dev_tools Refactor ci_testing and separate it from DevToolsPlugin (#13513) 2024-05-26 22:32:36 +00:00
bevy_diagnostic Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00
bevy_dylib Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00
bevy_dynamic_plugin Deprecate dynamic plugins (#13080) 2024-05-20 20:01:28 +00:00
bevy_ecs Add ability to clear all components on an entity via EntityWorldMut (#13588) 2024-05-31 16:42:03 +00:00
bevy_encase_derive Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00
bevy_gilrs Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00
bevy_gizmos Implemented GizmoPrimitive2d for Arc2d, CircularSegment, CircularSector, and make arc_2d use counter-clockwise angle. (#13610) 2024-06-01 12:30:34 +00:00
bevy_gltf glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
bevy_hierarchy Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00
bevy_input Separate state crate (#13216) 2024-05-09 18:06:05 +00:00
bevy_internal fix: upgrade to winit v0.30 (#13366) 2024-06-03 13:06:48 +00:00
bevy_log Improve tracing layer customization (#13159) 2024-05-12 21:16:56 +00:00
bevy_macro_utils Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00
bevy_math Implement ShapeSample for Extrusion<T> (#13567) 2024-05-30 12:08:28 +00:00
bevy_mikktspace Determine msrv for every standalone bevy_* crate. (#13211) 2024-05-13 18:26:41 +00:00
bevy_pbr Meshlet single pass depth downsampling (SPD) (#13003) 2024-06-03 12:41:14 +00:00
bevy_ptr add Debug for ptr types (#13498) 2024-05-24 21:25:11 +00:00
bevy_reflect Move bevy_math Reflect impls (#13520) 2024-05-27 14:15:22 +00:00
bevy_render fix: upgrade to winit v0.30 (#13366) 2024-06-03 13:06:48 +00:00
bevy_scene Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00
bevy_sprite More idiomatic texture atlas builder (#13238) 2024-06-03 12:43:50 +00:00
bevy_state Combine transition systems of Substates (#13626) 2024-06-02 13:36:44 +00:00
bevy_tasks fix: upgrade to winit v0.30 (#13366) 2024-06-03 13:06:48 +00:00
bevy_text Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
bevy_time Adds doc note that Timer and Stopwatch must be progressed manually (#13441) 2024-05-20 19:46:25 +00:00
bevy_transform Allow bevy_transform to be used as a barebones dependency (#13533) 2024-06-01 11:34:49 +00:00
bevy_ui Fix image measure function to apply inherent aspect ratio to style sizes (#13555) 2024-05-30 18:37:39 +00:00
bevy_utils fix: upgrade to winit v0.30 (#13366) 2024-06-03 13:06:48 +00:00
bevy_window fix: upgrade to winit v0.30 (#13366) 2024-06-03 13:06:48 +00:00
bevy_winit fix: upgrade to winit v0.30 (#13366) 2024-06-03 13:06:48 +00:00