Implement ApplicationHandler::can_create|destroy_surfaces() (#3765)
This commit is contained in:
parent
a0d69c782a
commit
75ce71f05a
21 changed files with 178 additions and 114 deletions
|
|
@ -20,7 +20,7 @@ fn main() -> Result<(), impl std::error::Error> {
|
|||
}
|
||||
|
||||
impl ApplicationHandler for Application {
|
||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||
fn can_create_surfaces(&mut self, event_loop: &ActiveEventLoop) {
|
||||
let attributes = Window::default_attributes()
|
||||
.with_title("parent window")
|
||||
.with_position(Position::Logical(LogicalPosition::new(0.0, 0.0)))
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ impl ApplicationHandler for ControlFlowDemo {
|
|||
}
|
||||
}
|
||||
|
||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||
fn can_create_surfaces(&mut self, event_loop: &ActiveEventLoop) {
|
||||
let window_attributes = Window::default_attributes().with_title(
|
||||
"Press 1, 2, 3 to change control flow mode. Press R to toggle redraw requests.",
|
||||
);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ fn main() -> std::process::ExitCode {
|
|||
}
|
||||
|
||||
impl ApplicationHandler for PumpDemo {
|
||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||
fn can_create_surfaces(&mut self, event_loop: &ActiveEventLoop) {
|
||||
let window_attributes = Window::default_attributes().with_title("A fantastic window!");
|
||||
self.window = Some(event_loop.create_window(window_attributes).unwrap());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
}
|
||||
}
|
||||
|
||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||
fn can_create_surfaces(&mut self, event_loop: &ActiveEventLoop) {
|
||||
let window_attributes = Window::default_attributes()
|
||||
.with_title("Fantastic window number one!")
|
||||
.with_inner_size(winit::dpi::LogicalSize::new(128.0, 128.0));
|
||||
|
|
|
|||
|
|
@ -459,8 +459,8 @@ impl ApplicationHandler for Application {
|
|||
info!("Device {device_id:?} event: {event:?}");
|
||||
}
|
||||
|
||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||
info!("Resumed the event loop");
|
||||
fn can_create_surfaces(&mut self, event_loop: &ActiveEventLoop) {
|
||||
info!("Ready to create surfaces");
|
||||
self.dump_monitors(event_loop);
|
||||
|
||||
// Create initial window.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
}
|
||||
|
||||
impl ApplicationHandler for XEmbedDemo {
|
||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||
fn can_create_surfaces(&mut self, event_loop: &ActiveEventLoop) {
|
||||
let window_attributes = Window::default_attributes()
|
||||
.with_title("An embedded window!")
|
||||
.with_inner_size(winit::dpi::LogicalSize::new(128.0, 128.0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue