-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Closed
Closed
Update to winit 0.29 #3606
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c93defd
WIP: Update to winit 0.29
fornwall 1a07d9d
Merge branch 'master' into master
fornwall 60a1792
Make it build again
fornwall b65e24d
Update to winit 0.29.4
fornwall 5b1b091
Return `winit::error::EventLoopError` to caller
emilk c6f0704
Fix clippy lint
emilk 4491fae
Return errors from `run_and_exit`
emilk 5e326fb
Only allow winit 0.29.4 and up
emilk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
use std::{cell::RefCell, rc::Rc, sync::Arc, time::Instant}; | ||
|
||
use glutin::{ | ||
context::NotCurrentGlContext, | ||
display::GetGlDisplay, | ||
prelude::{GlDisplay, NotCurrentGlContextSurfaceAccessor, PossiblyCurrentGlContext}, | ||
prelude::{GlDisplay, PossiblyCurrentGlContext}, | ||
surface::GlSurface, | ||
}; | ||
use raw_window_handle::{HasRawDisplayHandle as _, HasRawWindowHandle as _}; | ||
|
@@ -402,7 +403,7 @@ impl WinitApp for GlowWinitApp { | |
fn on_event( | ||
&mut self, | ||
event_loop: &EventLoopWindowTarget<UserEvent>, | ||
event: &winit::event::Event<'_, UserEvent>, | ||
event: &winit::event::Event<UserEvent>, | ||
) -> Result<EventResult> { | ||
crate::profile_function!(winit_integration::short_event_description(event)); | ||
|
||
|
@@ -434,15 +435,6 @@ impl WinitApp for GlowWinitApp { | |
EventResult::Wait | ||
} | ||
|
||
winit::event::Event::MainEventsCleared => { | ||
if let Some(running) = &self.running { | ||
if let Err(err) = running.glutin.borrow_mut().on_resume(event_loop) { | ||
log::warn!("on_resume failed {err}"); | ||
} | ||
} | ||
EventResult::Wait | ||
} | ||
|
||
winit::event::Event::WindowEvent { event, window_id } => { | ||
if let Some(running) = &mut self.running { | ||
running.on_window_event(*window_id, event) | ||
|
@@ -664,7 +656,7 @@ impl GlowWinitRunning { | |
fn on_window_event( | ||
&mut self, | ||
window_id: WindowId, | ||
event: &winit::event::WindowEvent<'_>, | ||
event: &winit::event::WindowEvent, | ||
) -> EventResult { | ||
crate::profile_function!(egui_winit::short_window_event_description(event)); | ||
|
||
|
@@ -703,10 +695,9 @@ impl GlowWinitRunning { | |
} | ||
} | ||
|
||
winit::event::WindowEvent::ScaleFactorChanged { new_inner_size, .. } => { | ||
if let Some(viewport_id) = viewport_id { | ||
winit::event::WindowEvent::ScaleFactorChanged { .. } => { | ||
if viewport_id.is_some() { | ||
repaint_asap = true; | ||
glutin.resize(viewport_id, **new_inner_size); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In winit 0.29 |
||
} | ||
} | ||
|
||
|
@@ -821,7 +812,7 @@ impl GlutinWindowContext { | |
// Create GL display. This may probably create a window too on most platforms. Definitely on `MS windows`. Never on Android. | ||
let display_builder = glutin_winit::DisplayBuilder::new() | ||
// we might want to expose this option to users in the future. maybe using an env var or using native_options. | ||
.with_preference(glutin_winit::ApiPrefence::FallbackEgl) // https://github.com/emilk/egui/issues/2520#issuecomment-1367841150 | ||
.with_preference(glutin_winit::ApiPreference::FallbackEgl) // https://github.com/emilk/egui/issues/2520#issuecomment-1367841150 | ||
.with_window_builder(Some(create_winit_window_builder( | ||
egui_ctx, | ||
event_loop, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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 properResumed
/Suspended
cycle?