Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/7948-emilkreport-occluded View snapshot changes at kitdiff |
There was a problem hiding this comment.
Pull request overview
Adds viewport occlusion state to egui’s ViewportInfo and wires native backends to populate it, enabling backends/apps to distinguish “hidden for rendering” from “should still run background logic” (per the linked issues).
Changes:
- Add
ViewportInfo::occluded: Option<bool>and aViewportInfo::visible()helper. - Populate
occludedfrom winitWindowEvent::Occludedin both wgpu and glow native integrations. - Add a small native test app (
tests/test_background_logic) to exercise backgroundlogicvsuibehavior and print viewport visibility flags.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
crates/egui/src/data/input.rs |
Extends ViewportInfo with occluded and adds visible() + debug UI display. |
crates/eframe/src/native/wgpu_integration.rs |
Updates per-viewport info on winit occlusion events (wgpu backend). |
crates/eframe/src/native/glow_integration.rs |
Updates per-viewport info on winit occlusion events (glow backend). |
tests/test_background_logic/src/main.rs |
New test app that periodically repaints and logs minimized/focused/occluded/visible. |
tests/test_background_logic/Cargo.toml |
Adds the new test crate to the workspace. |
Cargo.lock |
Lockfile update to include the new test crate. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
lucasmerlin
left a comment
There was a problem hiding this comment.
Nice! It doesn't log minimized when I minimize on macOS but I guess thats an unrelated issue?
|
Indeed - making sure that |
App::logiceven when hidden #5112App::logic#5113request_repaintignored if minimized #5136Once we support calling
App::logicwhen an app is occluded or minimized, it is useful to know that it is, in fact, occluded or minimized.