-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to winit 0.29 #3606
Update to winit 0.29 #3606
Conversation
"ndk-sys 0.5.0+25.2.9519653", | ||
"num_enum 0.7.1", | ||
"raw-window-handle 0.5.2", | ||
"raw-window-handle 0.6.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will want to disable default features on the ndk
to get rid of this.
(If there's no direct ndk
dependency, this will happen with the next winit 0.29.4
release - we forgot it in the update)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no direct ndk
dependency, I guess we can await winit 0.29.4
.
@@ -2620,10 +2703,10 @@ checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" | |||
dependencies = [ | |||
"libc", | |||
"log", | |||
"ndk", | |||
"ndk 0.7.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff-context suggests that this is ndk-glue
, which is long gone and replaced with android-activity
. Stale dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in ndarilek/tts-rs#50.
} | ||
EventResult::Wait | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to remove this, as winit::event::Event::Resumed
is handled above.
Let's make sure to test on Android - there is a eframe using example in android-activity
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're working on glow_integration
, it's probably wise to remove this stale comment entirely:
egui/crates/eframe/src/native/glow_integration.rs
Lines 36 to 46 in e037489
// Note: that the current Glutin API design tightly couples the GL context with | |
// the Window which means it's not practically possible to just destroy the | |
// window and re-create a new window while continuing to use the same GL context. | |
// | |
// For now this means it's not possible to support Android as well as we can with | |
// wgpu because we're basically forced to destroy and recreate _everything_ when | |
// the application suspends and resumes. | |
// | |
// There is work in progress to improve the Glutin API so it has a separate Surface | |
// API that would allow us to just destroy a Window/Surface when suspending, see: | |
// https://github.com/rust-windowing/glutin/pull/1435 |
The issue linked there has long been closed and fixed. Windows/Surfaces are only associated with context when/while it's made current, and it looks like eframe
supports Android now with a proper Resumed
/Suspended
cycle?
repaint_asap = true; | ||
glutin.resize(viewport_id, **new_inner_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In winit 0.29 ScaleFactorChanged
does not expose the new OS suggested window size. But, a Resized
event will come (recently fixed on macOS - rust-windowing/winit#3214).
@@ -39,7 +39,7 @@ fn create_event_loop(native_options: &mut epi::NativeOptions) -> EventLoop<UserE | |||
let mut builder = create_event_loop_builder(native_options); | |||
|
|||
crate::profile_scope!("EventLoopBuilder::build"); | |||
builder.build() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Add error handling.
@@ -160,7 +162,7 @@ fn run_and_return( | |||
EventResult::Exit => { | |||
log::debug!("Asking to exit event loop…"); | |||
winit_app.save_and_destroy(); | |||
*control_flow = ControlFlow::Exit; | |||
event_loop_window_target.exit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this winit_app.save_and_destroy()
- we are going to get a Event::LoopExiting
event later?
@@ -132,7 +134,7 @@ fn run_and_return( | |||
|
|||
match event_result { | |||
EventResult::Wait => { | |||
control_flow.set_wait(); | |||
event_loop_window_target.set_control_flow(ControlFlow::Wait); | |||
} | |||
EventResult::RepaintNow(window_id) => { | |||
log::trace!("Repaint caused by {}", short_event_description(&event)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cane some of this be simplified or removed for winit 0.29?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for working on this ❤️
I think this PR also fixes #3415 because the |
Btw, creating a PR from your
…that's why the egui PR template suggest you don't do it ;) In fact, I'm having trouble adding new commits to this PR now, for some obscure git reason |
Thanks @fornwall - I can push commits to the new branch |
This is a start for updating to winit 0.29.
A lot of things patched out, broken and not tested, but at least the
egui_demo_app
starts with both glow and wgpu, as well aspure_glow
(but are not functional).Review feedback and patches to fill out missing features and fix issues are welcome!
Replaces #3496 (closed that by mistake and couldn't reopen).