bevyengine / bevyengine/bevy

Take Winit's `WindowEvent::Occluded` into account

Open
#11,229 0 comments 0 reactions 0 assignees View on GitHub
A-Rendering A-Windowing C-Feature C-Performance
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## 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`](https://docs.rs/winit/0.29.9/winit/event/enum.WindowEvent.html#variant.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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.