Skip to content
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

winit backend: window.request_redraw() within RedrawRequested not working #3

Open
rib opened this issue Jul 4, 2022 · 0 comments
Open

Comments

@rib
Copy link
Collaborator

rib commented Jul 4, 2022

While investigating a crash in #2 we later saw an issue with window.request_redraw() not working as expected if issued during a RedrawRequested callback:

I.e. This didn't work:

Event::RedrawRequested(_) => {
	(..)
	guard.surface_state.as_ref().unwrap().window.request_redraw();
}

...but adding an if check inside RedrawEventsCleared did the trick

Event::RedrawEventsCleared => {
	let mut guard = app.read().unwrap();
	if let Some(surface_state) = &guard.surface_state {
		guard.surface_state.as_ref().unwrap().window.request_redraw();
	}
}

Originally posted by @tshrpl in https://github.com/rib/android-activity/issues/2#issuecomment-1137457821

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant