degenview-eframe 0.37.0

eframe 0.37.0 (the egui framework) plus a Wayland fix: a viewport the app hid is no longer presented. Maintained for DegenView.
Documentation

degenview-eframe

This is a fork. It is eframe 0.37.0 from the egui project (Emil Ernerfeldt and contributors) with one small Wayland fix, published for DegenView. It is not affiliated with or endorsed by the egui project. If you do not need the fix, use eframe.

What it changes

On Wayland, a viewport the app hid is no longer painted or presented.

Wayland cannot hide a toplevel window. Upstream eframe presents every viewport on every pass, which maps a viewport the app asked to hide, and winit then gates that window's redraws on frame callbacks that compositors withhold from a window nobody sees (minimized, or on another virtual desktop). A hidden root viewport that drives other viewports then stalls until the user makes it visible again: dialogs that should close stay open, new windows do not open. This is degenview/degenview#622.

With this fork, Viewport::hidden records that the app asked for the viewport to be hidden (through NativeOptions::viewport or the viewport builder, and then through every ViewportCommand::Visible). On Wayland such a viewport still runs its ui pass, so App::update and the viewports it creates keep working, but it is not tessellated, painted or presented. Its surface never gets a buffer and stays unmapped. Its texture deltas wait for the next painted viewport, as they already do for a minimized one. Other platforms and visible viewports behave as in upstream.

The whole change is one commit, "Do not present a viewport the app hid on Wayland", in src/native/wgpu_integration.rs and src/native/glow_integration.rs (same shape in both renderers). It is first on top of the 0.36.2 import and again on top of the 0.37.0 import. Everything else in src/ is byte-identical to upstream.

egui 0.37 added a pass that runs only App::logic when a redraw is overdue. It creates and closes no viewports, so it does not replace this fix.

Base

Upstream eframe 0.37.0, crates/eframe of https://github.com/emilk/egui (commit 3c6eb8261c3293ad9c7ea1ed58487e038860ebef, from the crate's .cargo_vcs_info.json)
Imported from https://static.crates.io/crates/eframe/eframe-0.37.0.crate
sha256 of that file 9c5642501a65ca657d05f00c643a5c14ff2346cb3818032bfe23d58e1f8e5f84
Version here 0.37.0, the same number, so a dependency on this crate names the eframe release it is based on

Each upstream release is imported in a commit of its own, unmodified (src/, data/, Cargo.toml); git diff from that commit shows every change. Besides the source fix, the package metadata in Cargo.toml is ours (name, description, repository, keywords, include), Cargo.toml.orig, .cargo_vcs_info.json and Cargo.lock of the tarball are not kept (the first two describe upstream's workspace, the lock file is not used by dependents), and the license texts are added (the crates.io tarball does not ship them).

Use

The library is still called eframe, so use eframe::... keeps working:

[dependencies]
eframe = { package = "degenview-eframe", version = "=0.37.0", features = ["persistence"] }

Features are those of eframe 0.37.0. Pin the version exactly: this crate follows DegenView's needs, not upstream's release schedule.

Retirement

The crate goes away once egui ships an equivalent fix; DegenView then depends on eframe again. It will not be updated for new egui releases unless DegenView still needs it. Other changes belong in egui, not here.

License

MIT OR Apache-2.0, as upstream. See LICENSE-MIT and LICENSE-APACHE, copied from https://github.com/emilk/egui. The code is copyrighted by Emil Ernerfeldt and the egui contributors; the fix is contributed under the same terms.