Skip to content

Commit

Permalink
Merge pull request #560 from AlexHayton/master
Browse files Browse the repository at this point in the history
Remove ScaleFactorChanged. MainEventsCleared no longer exists.
  • Loading branch information
sotrh authored Jul 2, 2024
2 parents 49f9377 + 7e27f36 commit 66aea32
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions docs/beginner/tutorial2-surface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,9 @@ match event {
} if window_id == state.window().id() => if !state.input(event) {
match event {
// ...

WindowEvent::Resized(physical_size) => {
state.resize(*physical_size);
}
WindowEvent::ScaleFactorChanged { new_inner_size, .. } => {
// new_inner_size is &&mut so we have to dereference it twice
state.resize(**new_inner_size);
}
// ...
}
}
Expand Down Expand Up @@ -380,9 +375,6 @@ event_loop.run(move |event, control_flow| {
WindowEvent::Resized(physical_size) => {
state.resize(*physical_size);
}
WindowEvent::ScaleFactorChanged { new_inner_size, .. } => {
state.resize(**new_inner_size);
}
_ => {}
}
}
Expand Down Expand Up @@ -473,8 +465,8 @@ We need to update the event loop again to call this method. We'll also call `upd
// run()
event_loop.run(move |event, _, control_flow| {
match event {
// ...
Event::RedrawRequested(window_id) if window_id == state.window().id() => {
// ... with the other WindowEvents
WindowEvent::RedrawRequested(window_id) if window_id == state.window().id() => {
state.update();
match state.render() {
Ok(_) => {}
Expand All @@ -486,7 +478,9 @@ event_loop.run(move |event, _, control_flow| {
Err(e) => eprintln!("{:?}", e),
}
}
Event::MainEventsCleared => {

// ... at the end of the WindowEvent block
Event::AboutToWait => {
// RedrawRequested will only trigger once unless we manually
// request it.
state.window().request_redraw();
Expand Down

0 comments on commit 66aea32

Please sign in to comment.