mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
Only send the request-redraw on the next animation frame
This commit is contained in:
parent
fe5e300062
commit
9f801cf79e
|
@ -12,7 +12,7 @@ use stdweb::{
|
||||||
unstable::TryInto
|
unstable::TryInto
|
||||||
};
|
};
|
||||||
use stdweb::web::{
|
use stdweb::web::{
|
||||||
document,
|
document, window,
|
||||||
html_element::CanvasElement,
|
html_element::CanvasElement,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ pub struct MonitorHandle;
|
||||||
|
|
||||||
impl MonitorHandle {
|
impl MonitorHandle {
|
||||||
pub fn get_hidpi_factor(&self) -> f64 {
|
pub fn get_hidpi_factor(&self) -> f64 {
|
||||||
// TODO
|
|
||||||
1.0
|
1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,10 +71,10 @@ impl Window {
|
||||||
register(&target.runner, &canvas);
|
register(&target.runner, &canvas);
|
||||||
|
|
||||||
let runner = target.runner.clone();
|
let runner = target.runner.clone();
|
||||||
let redraw = Box::new(move || runner.send_event(Event::WindowEvent {
|
let redraw = Box::new(move || window().request_animation_frame(|| runner.send_event(Event::WindowEvent {
|
||||||
window_id: RootWI(WindowId),
|
window_id: RootWI(WindowId),
|
||||||
event: WindowEvent::RedrawRequested
|
event: WindowEvent::RedrawRequested
|
||||||
}));
|
})));
|
||||||
|
|
||||||
let window = Window {
|
let window = Window {
|
||||||
canvas,
|
canvas,
|
||||||
|
@ -95,7 +94,6 @@ impl Window {
|
||||||
height: 768.0,
|
height: 768.0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// TODO: most of these are no-op, but should they stay here just in case?
|
|
||||||
window.set_min_dimensions(attr.min_dimensions);
|
window.set_min_dimensions(attr.min_dimensions);
|
||||||
window.set_max_dimensions(attr.max_dimensions);
|
window.set_max_dimensions(attr.max_dimensions);
|
||||||
window.set_resizable(attr.resizable);
|
window.set_resizable(attr.resizable);
|
||||||
|
@ -191,7 +189,6 @@ impl Window {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_hidpi_factor(&self) -> f64 {
|
pub fn get_hidpi_factor(&self) -> f64 {
|
||||||
// TODO
|
|
||||||
1.0
|
1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +283,7 @@ impl Window {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_window_icon(&self, _window_icon: Option<Icon>) {
|
pub fn set_window_icon(&self, _window_icon: Option<Icon>) {
|
||||||
// TODO: should this set the favicon?
|
// Currently an intentional no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Reference in a new issue