pub struct RedrawScheduler {
pub pending: bool,
pub focused: bool,
pub occluded: bool,
pub paused: bool,
}Expand description
Redraw pacing: whether a frame is wanted, and whether the window can show one.
Other systems request a paint by writing pending = true; the window
backend asks the platform for a redraw only while the window is
visible (not occluded). That keeps an idle app from repainting at the
display rate, the way Qt gates requestUpdate on isExposed() and GTK
drives its frame clock.
The pump gates on visibility, not focus. On tiling window managers (Hyprland, sway) an unfocused window stays fully on-screen, so it must keep animating: a module’s off-thread position pump, restyle tweens, and scroll inertia all ride the redraw loop, and freezing them the moment focus leaves would stop a slider mid-drag. Only an occluded or minimized window parks.
The window backend owns focused, occluded, and paused, and calls
Self::recompute_paused when the first two change. Other code reads
them and writes only pending.
Fields§
§pending: boolSet to true to request a paint the next time the event loop goes
idle. Cleared once the paint is dispatched.
focused: booltrue when the window has keyboard focus. Tracked for the
WindowFocused message and the focus-return repaint; not part of
the pump gate (see RedrawScheduler::compute_paused).
occluded: booltrue when the window is fully occluded (covered by another window
or moved off-screen).
paused: boolWhether redraw requests are held back: recomputed whenever
occluded or focused changes, and true only while the window is
occluded.
Implementations§
Source§impl RedrawScheduler
impl RedrawScheduler
Sourcepub fn recompute_paused(&mut self)
pub fn recompute_paused(&mut self)
Recompute Self::paused after a change to focused or
occluded.
Sourcepub fn compute_paused(_focused: bool, occluded: bool) -> bool
pub fn compute_paused(_focused: bool, occluded: bool) -> bool
The pump gate: should the redraw loop park?
Only occlusion parks the loop. focused is accepted and ignored, so
a visible but unfocused window (the tiling window manager case) keeps
animating.
Sourcepub fn should_forward_redraw(&self) -> bool
pub fn should_forward_redraw(&self) -> bool
Whether the backend should ask the platform for a redraw: a paint is
pending and the window is not parked. Anything that wants a frame
while unfocused (a worker thread’s
crate::app::EventLoopWaker, a restyle tween, scroll inertia) sets
pending, and this gate lets it through.
Trait Implementations§
Source§impl Clone for RedrawScheduler
impl Clone for RedrawScheduler
Source§fn clone(&self) -> RedrawScheduler
fn clone(&self) -> RedrawScheduler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for RedrawScheduler
impl Component for RedrawScheduler
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor] required for working with relationships in dynamic contexts. Read more§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Debug for RedrawScheduler
impl Debug for RedrawScheduler
Source§impl Default for RedrawScheduler
impl Default for RedrawScheduler
impl Copy for RedrawScheduler
impl Resource for RedrawScheduler
Auto Trait Implementations§
impl Freeze for RedrawScheduler
impl RefUnwindSafe for RedrawScheduler
impl Send for RedrawScheduler
impl Sync for RedrawScheduler
impl Unpin for RedrawScheduler
impl UnsafeUnpin for RedrawScheduler
impl UnwindSafe for RedrawScheduler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
§impl<T> FromTemplate for T
impl<T> FromTemplate for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
§impl<T> Template for T
impl<T> Template for T
§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.