Skip to content

Take Winit's WindowEvent::Occluded into account #11229

@daxpedda

Description

@daxpedda

What problem does this solve or what need does it fill?

Currently Bevy will continue drawing even if the window isn't visible.

What solution would you like?

Use Winit's WindowEvent::Occluded event to track if a window is occluded or not, in which case stop drawing.

There should also be an option to disable that behavior, as e.g. some platforms offer previews of the window, which some applications may want to keep up-to-date.

What alternative(s) have you considered?

I'm not familiar enough with Bevy to know if users have further control of when to draw and when not to. If this is the case users could already do that themselves, as WindowEvent::Occluded is exposed as an event.

Additional context

Winit has offered this event since v0.27, but it was only implemented for X11 and MacOS. With v0.29 it still is not implemented for Windows, but at least for all other platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenA-WindowingPlatform-agnostic interface layer to run your app inC-FeatureA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile times

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions