revert idle
This commit is contained in:
parent
0065e5fd76
commit
ac1ea0f96d
3 changed files with 5 additions and 9 deletions
|
@ -479,7 +479,7 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
|
||||||
fn zoom(&self);
|
fn zoom(&self);
|
||||||
fn toggle_fullscreen(&self);
|
fn toggle_fullscreen(&self);
|
||||||
fn is_fullscreen(&self) -> bool;
|
fn is_fullscreen(&self) -> bool;
|
||||||
fn on_request_frame(&self, callback: Box<dyn FnMut(RequestFrameOptions) -> bool>);
|
fn on_request_frame(&self, callback: Box<dyn FnMut(RequestFrameOptions)>);
|
||||||
fn on_input(&self, callback: Box<dyn FnMut(PlatformInput) -> DispatchEventResult>);
|
fn on_input(&self, callback: Box<dyn FnMut(PlatformInput) -> DispatchEventResult>);
|
||||||
fn on_active_status_change(&self, callback: Box<dyn FnMut(bool)>);
|
fn on_active_status_change(&self, callback: Box<dyn FnMut(bool)>);
|
||||||
fn on_hover_status_change(&self, callback: Box<dyn FnMut(bool)>);
|
fn on_hover_status_change(&self, callback: Box<dyn FnMut(bool)>);
|
||||||
|
|
|
@ -38,7 +38,7 @@ pub struct WindowsWindowState {
|
||||||
pub border_offset: WindowBorderOffset,
|
pub border_offset: WindowBorderOffset,
|
||||||
pub appearance: WindowAppearance,
|
pub appearance: WindowAppearance,
|
||||||
pub scale_factor: f32,
|
pub scale_factor: f32,
|
||||||
pub restore_from_minimized: Option<Box<dyn FnMut(RequestFrameOptions) -> bool>>,
|
pub restore_from_minimized: Option<Box<dyn FnMut(RequestFrameOptions)>>,
|
||||||
|
|
||||||
pub callbacks: Callbacks,
|
pub callbacks: Callbacks,
|
||||||
pub input_handler: Option<PlatformInputHandler>,
|
pub input_handler: Option<PlatformInputHandler>,
|
||||||
|
@ -312,7 +312,7 @@ impl WindowsWindowStatePtr {
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub(crate) struct Callbacks {
|
pub(crate) struct Callbacks {
|
||||||
pub(crate) request_frame: Option<Box<dyn FnMut(RequestFrameOptions) -> bool>>,
|
pub(crate) request_frame: Option<Box<dyn FnMut(RequestFrameOptions)>>,
|
||||||
pub(crate) input: Option<Box<dyn FnMut(crate::PlatformInput) -> DispatchEventResult>>,
|
pub(crate) input: Option<Box<dyn FnMut(crate::PlatformInput) -> DispatchEventResult>>,
|
||||||
pub(crate) active_status_change: Option<Box<dyn FnMut(bool)>>,
|
pub(crate) active_status_change: Option<Box<dyn FnMut(bool)>>,
|
||||||
pub(crate) hovered_status_change: Option<Box<dyn FnMut(bool)>>,
|
pub(crate) hovered_status_change: Option<Box<dyn FnMut(bool)>>,
|
||||||
|
@ -734,7 +734,7 @@ impl PlatformWindow for WindowsWindow {
|
||||||
self.0.state.borrow().is_fullscreen()
|
self.0.state.borrow().is_fullscreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_request_frame(&self, callback: Box<dyn FnMut(RequestFrameOptions) -> bool>) {
|
fn on_request_frame(&self, callback: Box<dyn FnMut(RequestFrameOptions)>) {
|
||||||
self.0.state.borrow_mut().callbacks.request_frame = Some(callback);
|
self.0.state.borrow_mut().callbacks.request_frame = Some(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1012,7 +1012,6 @@ impl Window {
|
||||||
.log_err();
|
.log_err();
|
||||||
}
|
}
|
||||||
|
|
||||||
let invalidator_is_dirty = invalidator.is_dirty();
|
|
||||||
// Keep presenting the current scene for 1 extra second since the
|
// Keep presenting the current scene for 1 extra second since the
|
||||||
// last input to prevent the display from underclocking the refresh rate.
|
// last input to prevent the display from underclocking the refresh rate.
|
||||||
let needs_present = request_frame_options.require_presentation
|
let needs_present = request_frame_options.require_presentation
|
||||||
|
@ -1020,7 +1019,7 @@ impl Window {
|
||||||
|| (active.get()
|
|| (active.get()
|
||||||
&& last_input_timestamp.get().elapsed() < Duration::from_secs(1));
|
&& last_input_timestamp.get().elapsed() < Duration::from_secs(1));
|
||||||
|
|
||||||
if invalidator_is_dirty {
|
if invalidator.is_dirty() {
|
||||||
measure("frame duration", || {
|
measure("frame duration", || {
|
||||||
handle
|
handle
|
||||||
.update(&mut cx, |_, window, cx| {
|
.update(&mut cx, |_, window, cx| {
|
||||||
|
@ -1042,9 +1041,6 @@ impl Window {
|
||||||
window.complete_frame();
|
window.complete_frame();
|
||||||
})
|
})
|
||||||
.log_err();
|
.log_err();
|
||||||
|
|
||||||
// Return true if app is idle
|
|
||||||
!(invalidator_is_dirty || needs_present)
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
platform_window.on_resize(Box::new({
|
platform_window.on_resize(Box::new({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue