-
-
Notifications
You must be signed in to change notification settings - Fork 478
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
feat: Winit 0.30.0 #1675
Closed
Closed
feat: Winit 0.30.0 #1675
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
42a3c72
build: upgrade `winit` 0.29.2 → 0.30.0, avoid nontrivial migration
ErichDonGubler 05febd0
refactor(glutin_examples): lib: context/surface/window tuple to `stru…
ErichDonGubler 2dabaab
refactor(glutin_examples): lib: begin `App` state model
ErichDonGubler 41d2580
refactor(glutin_examples): `switch_render_thread`: lower `render_cont…
ErichDonGubler 94e4d73
refactor(glutin_examples): `switch_render_thread`: begin `App` state …
ErichDonGubler 341e841
refactor(glutin_examples): `switch_render_thread`: move event handlin…
ErichDonGubler 29b14da
refactor(glutin_examples): `switch_render_thread`: delegate `App::han…
ErichDonGubler c1711b7
refactor(glutin_examples): move window creation inside event loop
ErichDonGubler 8afd5f7
refactor(glutin_examples): `switch_render_thread`: migrate from `Even…
ErichDonGubler b12c7ee
refactor(glutin_examples): `lib`: migrate from `EventLoop::run` to `E…
ErichDonGubler bd053c1
feat: add sealed `trait GlutinEventLoop` to abstract over `{,Active}E…
marc2332 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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use raw_window_handle::{DisplayHandle, HandleError, HasDisplayHandle}; | ||
use winit::error::OsError; | ||
use winit::event_loop::{ActiveEventLoop, EventLoop}; | ||
use winit::window::{Window, WindowAttributes}; | ||
|
||
use crate::private::Sealed; | ||
|
||
/// [`ActiveEventLoop`] is the recommended way to interact with the event | ||
/// loop, but for compatibility purposes [`EventLoop`] is also supported | ||
/// although not recommended anymore as it has been deprecated by Winit. | ||
pub trait GlutinEventLoop: Sealed { | ||
/// Create the window. | ||
/// | ||
/// Possible causes of error include denied permission, incompatible system, | ||
/// and lack of memory. | ||
/// | ||
/// ## Platform-specific | ||
/// | ||
/// - **Web:** The window is created but not inserted into the web page | ||
/// automatically. Please see the web platform module for more | ||
/// information. | ||
fn create_window(&self, window_attributes: WindowAttributes) -> Result<Window, OsError>; | ||
|
||
/// Get a handle to the display controller of the windowing system. | ||
fn glutin_display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>; | ||
} | ||
|
||
impl Sealed for ActiveEventLoop {} | ||
|
||
impl GlutinEventLoop for ActiveEventLoop { | ||
fn create_window(&self, window_attributes: WindowAttributes) -> Result<Window, OsError> { | ||
self.create_window(window_attributes) | ||
} | ||
|
||
fn glutin_display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> { | ||
self.display_handle() | ||
} | ||
} | ||
|
||
impl<T> Sealed for EventLoop<T> {} | ||
|
||
impl<T> GlutinEventLoop for EventLoop<T> { | ||
#[allow(deprecated)] | ||
fn create_window(&self, window_attributes: WindowAttributes) -> Result<Window, OsError> { | ||
self.create_window(window_attributes) | ||
} | ||
|
||
fn glutin_display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> { | ||
self.display_handle() | ||
} | ||
} |
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,10 +1,10 @@ | ||
#![cfg(android_platform)] | ||
|
||
use winit::event_loop::EventLoopBuilder; | ||
use winit::event_loop::EventLoop; | ||
use winit::platform::android::EventLoopBuilderExtAndroid; | ||
|
||
#[no_mangle] | ||
fn android_main(app: winit::platform::android::activity::AndroidApp) { | ||
let event_loop = EventLoopBuilder::new().with_android_app(app).build().unwrap(); | ||
let event_loop = EventLoop::builder().with_android_app(app).build().unwrap(); | ||
glutin_examples::main(event_loop).unwrap() | ||
} |
Oops, something went wrong.
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.
Should mention changes to
glutin-winit
itself.