Skip to content

Only run App::ui if the application is visible#7950

Merged
emilk merged 1 commit intomainfrom
emilk/only-logic
Mar 2, 2026
Merged

Only run App::ui if the application is visible#7950
emilk merged 1 commit intomainfrom
emilk/only-logic

Conversation

@emilk
Copy link
Copy Markdown
Owner

@emilk emilk commented Mar 2, 2026

If the application is invisible (occluded or minimized), and the user calls .request_repaint, then we should call App::logic, but NOT App::ui.

There are still some situations where App::logic is not called when it should be, but at least now we can skip running the UI code when the app is invisible.

@emilk emilk added eframe Relates to epi and eframe performance Lower CPU/GPU usage (optimize) labels Mar 2, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 2, 2026

Preview available at https://egui-pr-preview.github.io/pr/7950-emilkonly-logic
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

@emilk emilk changed the title Only run App::logic if the application is invisible Only run App::ui if the application is visible Mar 2, 2026
@emilk emilk merged commit 1b8a9fe into main Mar 2, 2026
49 checks passed
@emilk emilk deleted the emilk/only-logic branch March 2, 2026 18:30
Masterchef365 pushed a commit to Masterchef365/egui that referenced this pull request Apr 3, 2026
* Closes emilk#5113
* Part of emilk#5112
* Part of emilk#5136

If the application is invisible (occluded or minimized), and the user
calls `.request_repaint`, then we should call `App::logic`, but NOT
`App::ui`.

There are still some situations where `App::logic` is not called when it
should be, but at least now we can skip running the UI code when the app
is invisible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eframe Relates to epi and eframe performance Lower CPU/GPU usage (optimize)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App::logic

1 participant