<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* [x] I have followed the instructions in the PR template
Hi, I've made an integration that allows egui to be embedded as a widget
inside of a GTK application. I'm planning to use it to draw interactive
plots via `egui_plot`, as I haven't found comparable plotting widgets in
GTK. I hope others will find this integration useful as well.
The library doesn't do its own rendering, it instead relies on
`egui_glow` to render inside of a GTK-provided OpenGL drawing area.
It is published on [crates.io](https://crates.io/crates/gtk-egui-area).
* Closes https://github.com/emilk/egui/issues/4976
* Part of #4378
* Implements parts of #843
### Background
Some widgets (like `Grid` and `Table`) needs to know the width of future
elements in order to properly size themselves. For instance, the width
of the first column of a grid may not be known until all rows of the
grid has been added, at which point it is too late. Therefore these
widgets store sizes from the previous frame. This leads to "first-frame
jitter", were the content is placed in the wrong place for one frame,
before being accurately laid out in subsequent frames.
### What
This PR adds the function `ctx.request_discard` which discards the
visual output and does another _pass_, i.e. calls the whole app UI code
once again (in eframe this means calling `App::update` again). This will
thus discard the shapes produced by the wrongly placed widgets, and
replace it with new shapes. Note that only the visual output is
discarded - all other output events are accumulated.
Calling `ctx.request_discard` should only be done in very rare
circumstances, e.g. when a `Grid` is first shown. Calling it every frame
will mean the UI code will become unnecessarily slow.
Two safe-guards are in place:
* `Options::max_passes` is by default 2, meaning egui will never do more
than 2 passes even if `request_discard` is called on every pass
* If multiple passes is done for multiple frames in a row, a warning
will be printed on the screen in debug builds:
![image](https://github.com/user-attachments/assets/c2c1e4a4-b7c9-4d7a-b3ad-abdd74bf449f)
### Breaking changes
A bunch of things that had "frame" in the name now has "pass" in them
instead:
* Functions called `begin_frame` and `end_frame` are now called
`begin_pass` and `end_pass`
* `FrameState` is now `PassState`
* etc
### TODO
* [x] Figure out good names for everything (`ctx.request_discard`)
* [x] Add API to query if we're gonna repeat this frame (to early-out
from expensive rendering)
* [x] Clear up naming confusion (pass vs frame) e.g. for `FrameState`
* [x] Figure out when to call this
* [x] Show warning on screen when there are several frames in a row with
multiple passes
* [x] Document
* [x] Default on or off?
* [x] Change `Context::frame_nr` name/docs
* [x] Rename `Context::begin_frame/end_frame` and deprecate the old ones
* [x] Test with Rerun
* [x] Document breaking changes
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo cranky`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
Created as per https://github.com/emilk/egui/discussions/3783
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Hello. I would like to maintain egui_glium. I have already updated my
fork to the newest version of glium. You can find it at:
https://github.com/fayalalebrun/egui_glium
Let me know about next steps regarding access to crates.io.
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo cranky`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review you PR, but my time is limited!
-->
* Update images in README.md
* Add ferris image to hello_world example
* Clean up and improve README.md, with top-level link to Rerun
* Move sections around
* Give credit to recent big-time contributors in the main README.md
* Better named profiling scopes
* Document everything in memory.rs
* Better doc-strings
* Add a section about dependencies to the main README.md
* Improve egui_extras docs
* fix typos
* Deprecate egui_glium - looking for new maintainer
egui_glium was the first backend of egui, and it served us well for
a long time, but we have long since moved on to glow and wgpu.
Not egui_glium is holding back an update to latest winit.
Since development on glium has long since been discontinued I will
therefore deprecate egui_glium with this PR.
The code is still there in the repository for a while longer,
but is no longer compiled.
If there is any interest in maintaining egui_glium, then fork it and
make a PR to remove the last egui_glium from this repository.
I will give you publish rights on crates.io.
* update glutin 0.30.2 -> 0.30.3
* cargo update -p backtrace
Updating crates.io index
Updating addr2line v0.17.0 -> v0.19.0
Updating backtrace v0.3.66 -> v0.3.67
Updating gimli v0.26.2 -> v0.27.1
Removing miniz_oxide v0.5.4
Updating object v0.29.0 -> v0.30.3
* cargo deny: allow duplicates of windows-sys, wayland-sys, and nix
* cargo-deny whitelist tiny-skia
Based on https://github.com/hasenbanck/egui_wgpu_backend
`egui-wgpu` is now an official backend for `eframe` (opt-in).
Use the `wgpu` feature flag on `eframe` and the `NativeOptions::renderer` settings to pick it.
Co-authored-by: Nils Hasenbanck <nils@hasenbanck.de>
Co-authored-by: Sven Niederberger <niederberger@embotech.com>
Co-authored-by: Sven Niederberger <73159570+s-nie@users.noreply.github.com>
* Remove integration name (it is always eframe)
* Remove egui_web crate
* Move egui_web/CHANGELOG.md into eframe/CHANGELOG.md
* Remove all mentions of egui_web
* Remove epi crate and absorb into eframe
* egui_glow: only use puffin on native
* Remove WASM doc from CI (we don't generate it anyways!)
* Remove eframe::epi and improve eframe docs
* Move examples out of eframe/examples into examples/
Give each example a `Cargo.toml` and `src/main.rs`.
This makes it easier for people to use as templates.
* Update README.md with more deps needed on vanilla Ubuntu
* Install libgtk-3-dev on CI, hoping that will fix something
It was noted that the problems with Firefox on Linux/MacOS have been resolved in #1377 and the limitation on the canvas size was lifted in commit 465c96122c