Skip to content

Conversation

@emilk
Copy link
Owner

@emilk emilk commented Dec 15, 2025

This is a breaking change, as it changes the how embedded viewports work.
Before it was up to the user to display a egui::Window if they wanted. Now egui creates an egui::Window for you, so you only need to add the contents.

To signal this change in behavior, ViewportClass::Embedded is gone and is now called ViewportClass::EmbeddedWindow.

@emilk emilk added the egui label Dec 15, 2025
@github-actions
Copy link

github-actions bot commented Dec 15, 2025

Preview available at https://egui-pr-preview.github.io/pr/7779-emilkviewport-ui
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 Add Window::from_viewport Viewports: give the caller a Ui instead of Context Dec 15, 2025
@emilk emilk merged commit 9487dc3 into main Dec 15, 2025
47 checks passed
@emilk emilk deleted the emilk/viewport-ui branch December 15, 2025 17:51
emilk added a commit that referenced this pull request Dec 16, 2025
* Part of #5113
* Part of #3524

## What
This deprecates `eframe::App::update` and replaces it with two new
functions:

```rs
pub trait App {
	/// Called just before `ui`, and in the future this will
    /// also be called for background apps when needed.
	fn logic(&mut self, ctx: &egui::Context, frame: &mut Frame) { }
	
    /// Show your user interface to the user.
	fn ui(&mut self, ui: &mut egui::Ui, frame: &mut Frame);

	…
}
```

Similarly, `Context::run` is deprecated in favor of `Context::run_ui`.

`Plugin`s are now handed a `Ui` instead of just a `Context` in
`on_begin/end_frame`.

## TODO
…either in this PR or a later one
* [x] Deprecate `App::update`
* [x] Deprecate `Context::run`
* [x] Change plugins to get a `Ui`
* [x] Update kittest
* [x] Change viewports to get UI:s (`show_viewport_immediate` etc)
  - #7779

## Later PRs
* [ ] Deprecate `Panel::show`
* [ ] Deprecate `CentralPanel::show`
* [ ] Deprecate `CentralPanel` ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants