On Wayland, use frame callbacks to throttle RedrawRequested

Throttle RedrawRequested events by the frame callbacks, so the users
could render at the display refresh rate.
This commit is contained in:
Kirill Chibisov 2023-06-22 09:12:47 +04:00
parent 38f28d5836
commit 7a58fe58ce
6 changed files with 151 additions and 85 deletions

View file

@ -38,7 +38,7 @@ use super::state::WinitState;
use super::types::xdg_activation::XdgActivationTokenData;
use super::{EventLoopWindowTarget, WindowId};
mod state;
pub(crate) mod state;
pub use state::WindowState;
@ -295,7 +295,7 @@ impl Window {
#[inline]
pub fn pre_present_notify(&self) {
// TODO
self.window_state.lock().unwrap().request_frame_callback();
}
#[inline]