-
Notifications
You must be signed in to change notification settings - Fork 950
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
Implement revamped RedrawRequested on Windows #1050
Implement revamped RedrawRequested on Windows #1050
Conversation
@notriddle, since you are on the testers list, would you like to test this? Please make sure the examples don't freeze, and the ordering of the events is consistent with what is proposed here: #1041 Thanks :) |
Okay, I went ahead and tried some of the examples. win32_text example fails to compile
and eating a constant 10% of my CPU.
In both cases, while the window is pure white on master, it's white on top with black on the bottom on your branch, which makes me think there's something wrong with how it paints. |
What happens if you call |
You mean like this? PS C:\Users\micha\IdeaProjects\winit> git diff
diff --git a/examples/window.rs b/examples/window.rs
index e2265dbd..a6d161fe 100644
--- a/examples/window.rs
+++ b/examples/window.rs
@@ -20,7 +20,7 @@ fn main() {
event: WindowEvent::CloseRequested,
window_id,
} if window_id == window.id() => *control_flow = ControlFlow::Exit,
- Event::MainEventsCleared => {
+ Event::MainEventsCleared | Event::RedrawEventsCleared => {
window.request_redraw();
}
_ => *control_flow = ControlFlow::Poll, Same perpetual hot loop. Chews through 10% of my CPU. |
Sorry, I was just asking in general if there is any difference in behavior when With that said, the control flow is set to |
Oh, you're right. In master, it's set up like this
But it's not set up that way on the branch. Oops. If I change it to Wait, with this branch being run, it works right. My mistake. I applied this patch to the window example, and now it behaves reasonable. I thought I had locked it up, but I can't reproduce it more than once. diff --git a/examples/window.rs b/examples/window.rs
index e2265dbd..42738434 100644
--- a/examples/window.rs
+++ b/examples/window.rs
@@ -23,7 +23,7 @@ fn main() {
Event::MainEventsCleared => {
window.request_redraw();
}
- _ => *control_flow = ControlFlow::Poll,
+ _ => *control_flow = ControlFlow::Wait,
}
});
} |
@Osspial is this ready for merging, it appears to work, no? |
0558e9d
to
6629f8a
Compare
@zegentzy I've rebased this against murarth's changes so it should be good now. |
* Move event loop runner to runner module * Implement new redraw API
* Move event loop runner to runner module * Implement new redraw API
* Move event loop runner to runner module * Implement new redraw API
* Move event loop runner to runner module * Implement new redraw API
* Move event loop runner to runner module * Implement new redraw API
* Move event loop runner to runner module * Implement new redraw API
cargo fmt
has been run on this branchCHANGELOG.md
if knowledge of this change could be valuable to usersI wrote this up before submitting #1041 so I could verify that the API would solve the problems I wanted it to solve. This is still tentative since I don't believe we've reached a conclusion on #1041, but it implements my version of the proposal, so even if it doesn't get merged it's still worthwhile to have around for testing purposes.