Commit Graph
4634 Commits
Author SHA1 Message Date
e7c7b00a93 Deprecate Id::new and From<&str> for Id (#8534)
`Id::new` and `From<&str> for Id` etc are foot-guns: they hide the fact
that an `Id` MUST be globally unique (well, at least unique within your
app).

So this PR removes both and replaces them with `Id::unique`, which is
very explicit.
In places where non-uniqueness is desired, you can use `IdSalt`, which
has the convenient `From<&str>`.

Most changes are in tests.

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2026-09-09 16:03:15 +02:00
7053d3917a Merge 0.36.2 changelog (#8533)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 15:29:48 +00:00
Lucas Meurer 521fb0f55c Add Plugin::on_exit (#8527)
Allows plugins to save state, do cleanups, act before the exit
2026-09-08 16:08:01 +02:00
Lucas Meurer 416dd85acb Make ViewportCommand::Screenshot callback based (#8489)
Migration guide for the changelog:
`ViewportCommand::Screenshot` was changed to be callback based.
Previously you needed to iter the input events to check for the
screenshot (but didn't need interior mutability):
```rs
[derive(Default)]
struct MyApp {
    screenshot: Option<Arc<egui::ColorImage>>,
}
impl eframe::App for MyApp {
    fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
        if ui.button("Screenshot").clicked() {
            ui.send_viewport_cmd(ViewportCommand::Screenshot(UserData::default()));
        }

        let image = ui.input(|i| {
            i.events
                .iter()
                .filter_map(|e| {
                    if let egui::Event::Screenshot { image, .. } = e {
                        Some(Arc::clone(image))
                    } else {
                        None
                    }
                })
                .next_back()
        });
        
        if let Some(image) = image {
            self.screenshot = Some(image);
        }
    }
}
```

Now you need to use a mutex, channel, or some other sync primitive to
get the result:
```rs
#[derive(Default)]
struct MyApp {
    screenshot: Arc<Mutex<Option<Arc<egui::ColorImage>>>>,
}
impl eframe::App for MyApp {
    fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
        if ui.button("Screenshot").clicked() {
            let ctx = ui.ctx().clone();
            let screenshot_mutex = self.screenshot.clone();
            ui.request_screenshot(move |screenshot| {
                screenshot_mutex.lock().replace(screenshot);
                ctx.request_repaint();
            });
        }
    }
}
```
----



This implements a callback-based screenshot api for egui

Upsides over `ViewportCommand::Screenshot`:
- More convenient api: `ctx.request_screenshot(|screnshot| ...)` (and no
need to downcast UserData)
- Reading screenshot data doesn't require rendering another frame
- Should allow us to add recording as a plugin without special hooks in
egui_kittest (otherwise capturing the last frame would have required
custom hooks in kittest)
- This was also a problem in
[kittest_inspector](https://github.com/rerun-io/kittest_inspector): When
streaming a real app, the frame seen was always a couple frames behind
when the app was idle
2026-09-08 16:06:18 +02:00
Emil ErnerfeldtandClaude Fable 5.1 2f4d90c989 Add TextEdit::event_filter (#8530)
Lets you control which keys a `TextEdit` captures while it has focus,
instead of letting egui use them for focus navigation. Needed e.g. for a
completion popup, where Tab and Escape should act on the popup rather
than move focus away.

Split out from:
* https://github.com/emilk/egui/pull/8529

* [x] I have followed the instructions in the PR template

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-08 15:45:49 +02:00
Lucas Meurer 9164280a60 Add AtomKind::Paint (#8524)
Allows one to do custom painting in places where reading the
`AtomLayoutResponse` may be hard or impossible.
Also very useful when combined with `AtomKind::Closure`
2026-09-08 13:45:13 +02:00
Lucas Meurer 57160f5e9e Fix compile error with web_sys_unstable_apis (#8521)
Web sys changes the signature of `get_image_data` based on the flag. In
rerun we need `web_sys_unstable_apis` so we need to handle this in egui
2026-09-07 13:11:59 +02:00
ishuowang e2850d138b Fix color picker RGB drift when editing alpha (#8483)
Closes #8478.

Editing the alpha `DragValue` rebuilt the full HSVA color from the
displayed RGBA values, which could re-quantize RGB. This tracks RGB and
alpha edits separately so alpha-only edits preserve RGB.

Adds regression coverage for gamma-byte and linear numeric color spaces.

- [x] I have followed the instructions in the PR template
2026-09-07 12:15:57 +02:00
Leo Timmins da7169ed1a Fix egui-winit compilation on wasm32 (#8516)
Disclosure - AI written PR with GPT 6
I was unable to compile for wasm on my project because I use egui-winnit
instead of eframe

See AI explanation below:

## Summary

* Fixes #8436

`egui-winit` unconditionally compiled `NativeFile`, which implements
`DroppedFile::bytes()`. On wasm32, the trait requires `bytes_async()`
instead, causing compilation to fail.

This change gates the native file implementation and its usage to native
targets. An explicit wasm fallback ignores dropped-file events, which
winit’s web backend does not emit.

Adds a direct wasm compilation check to CI and the local check script,
since eframe’s wasm builds do not compile egui-winit.

## Validation

- wasm32 compilation with default features disabled passes.
- Native Linux/X11 compilation passes.
- Formatting and shell syntax checks pass.
- Strict wasm Clippy encounters six existing, unrelated warnings in
clipboard.rs.
2026-09-07 10:57:16 +02:00
Lucas Meurer 7bda288fe6 Log when system_font feature is off (#8520) 2026-09-07 08:54:37 +00:00
Lucas Meurer 83ca91e8d7 Enable system fonts for demo app (#8519) 2026-09-07 08:21:08 +00:00
Emil ErnerfeldtandClaude Opus 5 f161959d59 CI: run once per PR, and stop PR caches from evicting the main cache (#8507)
The `Run tests` job takes 9-12 minutes because it finds no cargo cache
and rebuilds all 390 crates; the last run that hit the cache took 4m20s
for the whole job. The repository holds 30 caches totalling 10.6 GB,
over the 10 GB limit, so entries are evicted constantly. Each PR saves
its own ~2.5 GB copy of every job cache, which pushes out the `main`
cache that every new PR starts from.

* `on: [push, pull_request]` ran the whole workflow twice for a PR from
a branch in this repo, doubling both runner time and cache writes. The
push half now only runs for `main`.
* Only `main` writes to the cargo cache (`save-if`). PRs still read it.
* New workflow deletes the caches of a PR when it is closed.

* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 09:51:25 +02:00
Emil Ernerfeldt 7809b4fd9a Update dependencies (#8515)
Updated: `enum-map` 3.1, `env_logger` 0.11.11, `font-types` 0.12.4,
`image` 0.25.10, `log` 0.4.34, `smallvec` 1.16, `webbrowser` 1.2.4, plus
transitive bumps.

`syn` is now allowed to be duplicated in `deny.toml`: the ecosystem is
migrating from syn 2 to syn 3, and syn is build-time only, so the
duplicate costs compile time, not binary size. That unblocks `enum-map`
3.1, `serde` 1.0.229 and `thiserror` 2.0.20.

Held back (comments in `Cargo.toml` explain why): `accesskit*` (kittest
0.4), `glow` (wgpu 30), `harfrust`/`skrifa` (fontique, glifo), `resvg`
(tiny-skia via winit), `smithay-clipboard` (winit), `wasm-bindgen`
family.

* [x] I have followed the instructions in the PR template

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-09-06 07:12:58 +00:00
Emil ErnerfeldtandClaude Fable 5.1 f2de65f636 Render any glyph and colored emoji on native 🚀 (#8512)
Add full emoji support to eframe on native! Also supports any glyph that
your system fonts support.

Test string: ✨ We support ไทย, 한국어, and 🦀 🚀 🤖/🦾/📷/🎞️

Chain, in order, all merged into `emilk/emojis`:

* https://github.com/emilk/egui/pull/8491
* https://github.com/emilk/egui/pull/8492
* https://github.com/emilk/egui/pull/8493
* https://github.com/emilk/egui/pull/8508
* https://github.com/emilk/egui/pull/8509
* https://github.com/emilk/egui/pull/8510
* https://github.com/emilk/egui/pull/8511

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-06 08:27:50 +02:00
Emil ErnerfeldtandClaude Fable 5.1 e39e793d5c Remove the Font borrow-bag; put its methods on FontsImpl (#8504)
`Font<'a>` was a hand-rolled split borrow of every field of `FontsImpl`,
and it grew a new `&'a mut` for each new feature. `text_layout` now
calls `FontsImpl` directly (`resolve_face`, `glyph_info`,
`allocate_glyph`, `rasterize_cluster`, …) with a cheap `FamilyKey` index
instead of re-hashing the `FontFamily` per glyph.

`font.rs` is renamed to `font_face.rs`, since only `FontFace` is left in
it. `FontsView::characters` replaces `f.fonts.font(family).characters()`
in the font book demo.

`FontsImpl` and `epaint::text::layout` are now crate-private: nothing
outside `epaint` used them, and `Fonts` / `FontsView` cover the public
API. The `fonts` fields of `Fonts` and `FontsView` are private too. The
benchmark that used `layout` directly now calls the new
`Fonts::layout_uncached`.

* [x] I have followed the instructions in the PR template

PR chain, in order:
* #8490
* #8500
* #8501
* #8502
* #8503
* #8504
* #8491
* #8492
* #8493

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 17:01:45 +00:00
Emil ErnerfeldtandClaude Fable 5.1 0132e5dbb9 Replace CachedFamily with Family, which owns the fallback walk (#8503)
`Family::resolve` is now the only place that decides which face renders
a char: it walks the chain, consults the per-char cache, and falls back
to the replacement face. `Font` no longer reaches into the family's
fields. Asking font providers (#8491) for a missing char becomes one
more branch in `Family::resolve`.

* [x] I have followed the instructions in the PR template

PR chain, in order:
* #8490
* #8500
* #8501
* #8502
* #8503
* #8504
* #8491
* #8492
* #8493

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 16:27:43 +00:00
Emil ErnerfeldtandClaude Fable 5.1 c457299367 Add FaceStore: one place that parses and stores font faces (#8502)
`FaceStore` wraps the old `fonts_by_id` and `fonts_by_name` maps and
owns `FontFaceKey`. It has a single `install(name, &FontData)` so fonts
from `FontDefinitions` and fonts found later by a font provider (#8491)
go through the same code.

* [x] I have followed the instructions in the PR template

PR chain, in order:
* #8490
* #8500
* #8501
* #8502
* #8503
* #8504
* #8491
* #8492
* #8493

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 15:49:47 +00:00
Emil ErnerfeldtandClaude Opus 5 368415fc82 Deprecate global_theme_preference_switch in favor of global_theme_preference_buttons (#8505)
`global_theme_preference_switch` can only toggle between dark and light
mode, with no way back to following the system theme.

`global_theme_preference_buttons` covers all three, and now uses compact
icon-only buttons (💻 🌙 ☀), so it fits in a top bar too. The demo app now
uses it.

* Rename `ThemePreference::radio_buttons` to `ThemePreference::buttons`
(old name deprecated)
* Add `ThemePreference::icon` and `ThemePreference::name`

* [x] I have followed the instructions in the PR template

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 15:36:32 +00:00
Emil ErnerfeldtandClaude Opus 5 725ed5b523 Run all tests in CI even when a snapshot test fails (#8506)
Run the tests with `--no-fail-fast`, in CI and in `scripts/check.sh`.

`cargo test` stops after the first failing test target, so one failing
snapshot test in `egui_demo_app` hid the failing snapshots of every
later crate, and it took several CI rounds to collect all the new
snapshots. Now one run reports them all and uploads all `.new.png`
files, so one kitdiff pass is enough.

`egui_kittest` already collects all snapshot errors of a test in one
`SnapshotResults` and only panics when it is dropped, so no change is
needed there.

* [x] I have followed the instructions in the PR template

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 15:30:24 +00:00
Emil ErnerfeldtandClaude Fable 5.1 79d823e67e Move glyph bitmap caches out of FontFace into a new GlyphAtlas (#8501)
`GlyphAtlas` owns the `TextureAtlas` plus every cache that points into
it (outline glyphs keyed by face, and platform-rasterized glyphs).
`FontFace` no longer knows about the atlas: it just renders an outline
to a bitmap.

When the atlas gets full, `Fonts::begin_pass` now clears the bitmaps
instead of reparsing and re-hinting every font face. That also removes
the duplicated `glyph_rasterizer` field on `Fonts`, which only existed
to survive the rebuild. Fonts found by font providers (#8491) will
survive an atlas clear the same way.

* [x] I have followed the instructions in the PR template

PR chain, in order:
* #8490
* #8500
* #8501
* #8502
* #8503
* #8504
* #8491
* #8492
* #8493

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 15:22:14 +00:00
Emil ErnerfeldtandClaude Fable 5.1 f08c4ff404 Split fonts.rs and font.rs into one file per type (#8500)
Pure move, no logic changes. First step of a chain that untangles
`Font`, `FontsImpl`, and `CachedFamily` ahead of font providers (#8491).

New files under `crates/epaint/src/text/`: `font_id.rs`, `font_data.rs`,
`font_tweak.rs`, `font_definitions.rs`, `glyph_rasterizer.rs`,
`galley_cache.rs`, `styled_metrics.rs`, `unicode.rs`.

* [x] I have followed the instructions in the PR template

PR chain, in order:
* #8490
* #8500
* #8501
* #8502
* #8503
* #8504
* #8491
* #8492
* #8493

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 14:47:03 +00:00
Lucas Meurer be69f38fcd Make widget_style public again (#8488)
It was accidentally made private in #8153 unless experimental, even
though it was already public before. Make it public again.
2026-09-05 16:05:15 +02:00
Emil ErnerfeldtandClaude Fable 5.1 f7b4e41cf1 Render any glyph and colored emoji on web (#8490)
* Closes https://github.com/emilk/egui/pull/7852
* Web-only support for https://github.com/emilk/egui/issues/2551
* Related to https://github.com/emilk/egui/issues/7325

This adds support for rendering _any glyph_ on web, including colored
emojis!

Test string: ✨ We support ไทย, 한국어, and 🦀 🚀 🤖/🦾/📷/🎞️

<img width="435" height="115" alt="Screenshot 2026-09-03 at 20 29 43"
src="https://github.com/user-attachments/assets/86133103-8474-48b8-8792-e48ac3a4286c"
/>
<img width="465" height="111" alt="Screenshot 2026-09-03 at 20 29 36"
src="https://github.com/user-attachments/assets/7f7fb2a6-a6c6-42b1-85df-6c5745523ea4"
/>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 07:43:38 +00:00
Lucas Meurer e63fa0b314 Add new render_every_step flag to egui_kittest (#8487)
Some applications / test depend on specific gpu state and may be doing
gpu-readback. This adds a `always_render` flag, which calls `render`
every frame so that the gpu dependent logic will work correctly.
It also saves the last render result so we don't have to render the same
frame twice.
2026-09-03 14:54:51 +00:00
Lucas MeurerandClaude Opus 5 9cb53feab4 Add tests for StyleProvider and ensure every property works (#8477)
Follow up to #8455

Based on #8485

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 16:50:30 +02:00
Lucas MeurerandClaude Opus 5 2b34fe0c1c Add Align2 helpers (#8485)
Add utilities to make it easier to construct and use `Align2`

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 15:55:33 +02:00
Emil Ernerfeldt 1a9d2af9ef Fix panic in hit-test when a widget rect contains a NaN (#8479)
* Closes <https://github.com/emilk/egui/issues/7870>
* [x] I have followed the instructions in the PR template

`WidgetRect` derives `PartialEq`, so a rect with a NaN coordinate is not
equal even to itself, and `close.iter().position(|w| *w ==
hit_click).unwrap()` panicked. We now look the hit up by id.

NaN rects got that far because `Rect::intersect` scrubs NaNs
(`f32::max(NAN, x) == x`), so `interact_rect` can be finite while `rect`
is not, sneaking past the existing NaN guard. Hit-testing now discards
those widgets too.

Finally, `Pos2` claims `Eq` while NaN breaks reflexivity, so `PartialEq`
is now hand-written and panics on NaN in debug builds.
2026-09-03 13:16:14 +00:00
cui fliterandEmil Ernerfeldt ec9b708a95 Fix zero-duration value animations returning the previous value (#8469)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/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!
* Keep PR description short and to the point! No long LLM slop.
* 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 a human has reviewed it
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

animate_value_with_time returned the previous value for one frame when
called with a zero duration because it calculated the current value
before updating the animation target.

Handle zero-duration animations before interpolation so they immediately
return and store the target value. Add a regression test covering
consecutive target changes.


* Closes <https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE>
* [x] I have followed the instructions in the PR template

Signed-off-by: cuishuang <imcusg@gmail.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-09-03 13:48:23 +02:00
Emil Ernerfeldt dcda8664ab Fix rendering of thin, angled rectangles (#8482)
We had a fast path for very thin rectangles, but it did not heed the
angle of the rect
2026-09-02 19:23:52 +00:00
Lucas MeurerandClaude Opus 5 7c38c552e4 StyleProvider for TextEdit and DragValue (#8455)
Implements `StyleProvider` for `TextEdit`, so you can fully style it as
you please

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 11:42:31 +02:00
Lucas MeurerandClaude Opus 5 5cb3a4f89e Add AtomLayoutStyle (#8465)
Extracts a shared struct with things that once might want to override
for any atomlayout-based widget.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 11:27:17 +02:00
BernardDGSandEmil Ernerfeldt dadf573dde Add clipboard image paste support (Event::PasteImage) (#8472)
Adds `egui::Event::PasteImage`, emitted on Ctrl+V/Cmd+V when the
clipboard holds an
image with no usable text representation (mirrors
`OutputCommand::CopyImage` for
the opposite direction). `egui-winit::Clipboard` gains `get_image()`,
backed by
`arboard::Clipboard::get_image()` — the symmetric counterpart to the
`set_image()`
already used for copy. Wired in the winit keyboard-shortcut path and in
both the
glow and wgpu eframe backends' AccessKit-driven paste action.

Straight (unmultiplied) alpha from the OS clipboard is converted via the
existing
`ColorImage::from_rgba_unmultiplied` helper rather than reinterpreting
bytes
directly, since the two aren't bit-compatible for translucent pixels.

Not covered here: the web (wasm32) target — browser clipboard image
reads are
inherently async (`Blob::array_buffer` returns a Promise), while
`Event::PasteImage`
as designed here carries an already-decoded `ColorImage`. Bridging that
needs
either an async event payload or a deferred/queued event on `AppRunner`
— more of
a design decision than a small mirrored addition, flagging it rather
than guessing.

* Related: #2108 (not fixed: web)

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-09-01 17:00:43 +00:00
Lucas Meurerandemilk e1507d031d Properly respect min_size in TextEdit (#8420)
TextEdit has a min_size field but we completely ignored in the y
direciton. (I probably broke it in #7140).

---------

Co-authored-by: emilk <1148717+emilk@users.noreply.github.com>
2026-09-01 09:39:32 +00:00
Lucas MeurerandClaude Opus 5 de077b92d3 Rename classes, more button options via StyleProvider (#8464)
Moves global classnames to e.g. `egui::class::ROOT`.

Widget specific classes live on the widgets struct. 

Adds some more classes for our buttons styling options (`CLASS_SMALL`
etc), so that custom `StyleProvider`s can choose to implement them
differently or ignore them altogether.


Also removes some styleproviders that were partly or completely unused
(e.g. basestyle / labelstyle). We can add them back once we actually
implement styling for those.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 11:39:13 +02:00
Joaquim Monteiro 080d512f45 Fix widgets shifting around on hover in interactive container demo (#8471)
This happens because `bg_stroke`'s width isn't constant.

| Before | After |
|--------|--------|
| <img width="320" height="320" alt="before"
src="https://github.com/user-attachments/assets/0101e5fb-0781-4867-9891-c91d49dbb969"
/> | <img width="320" height="320" alt="after"
src="https://github.com/user-attachments/assets/4223218a-2f5f-4542-9fe2-67be5799ca81"
/> |

---

<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/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!
* Keep PR description short and to the point! No long LLM slop.
* 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 a human has reviewed it
* 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
2026-09-01 11:27:47 +02:00
Lucas Meurer 47fa50d9a7 Add diagnostic_max_steps for a betterExceededMaxStepsError (#8421)
This allows you to see how many more steps it would have taken for the
harness to settle.
Useful to see if you're in a infinite repaint loop or just need a
`harness.run_steps(3)` to give it some more frames to settle.
Should make it easier to make the default step count tighter, which
should make tests faster.
2026-08-31 15:29:10 +02:00
Emil Ernerfeldt 7b34fc0e03 Point Rust Analyzer to target/rust-analyzer (#8463) 2026-08-31 11:01:10 +02:00
limo520 5d3e958ecf Fix the constrain option not working in the window options demo (#8433)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/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!
-->
`constrain_to` overrides `constrain`, so I adjusted it to call
`constrain_to` before `constrain`.

* [x] I have followed the instructions in the PR template

Signed-off-by: limo520 <247564335@qq.com>
2026-08-27 01:14:01 +00:00
caea233a47 Fix wgpu padding (#8448)
The Egui web example was throwing an error in WGPU. In this case, the
error was
```
panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-30.0.0/src/backend/wgpu_core.rs:1414:26: wgpu error: Validation Error Caused by: In Device::create_render_pipeline, label = ‘egui_pipeline’ In the provided shader, the type given for group 1 binding 2 has a size of 4. Since the device does not support DownlevelFlags::BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED`, the type must have a size that is a multiple of 16 bytes
```

One reference I used was the following Pull Request:
<https://github.com/viridia/quill/pull/14>

The biggest change I made was in `egui-wgpu` to
`r_tex_nearest_filtering`

Shader (`egui.wgsl`)
```wgsl
// Old 
@group(1) @binding(2) var<uniform> r_tex_nearest_filtering: u32;

// New
@group(1) @binding(2) var<uniform> r_tex_nearest_filtering: vec4<u32>;
```

And with the corresponding changes in `renderer.rs`, I ran it locally
and it worked perfectly in Firefox 149 and Chromium 151 (Both fail when
attempting to access https://www.egui.rs/#demo, returning the error
described above)

* Closes <https://github.com/emilk/egui/issues/8446>
* Fixes <https://github.com/emilk/egui/issues/8446>
* [X] I have followed the instructions in the PR template

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-26 06:09:32 +00:00
Emil ErnerfeldtandLucas Meurer 35b069585d Add an LLM policy (#8458)
https://www.smbc-comics.com/comic/blame

---------

Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2026-08-25 13:41:02 +00:00
Zachary Harvie f228ed2232 Fix egui-wgpu build on wasm32-unknown-emscripten (#8454)
Fix a build issue in the `egui-wgpu` crate when building for the
`wasm32-unknown-emscripten` target. WGPU does not support the WebGPU
backend on that target.
2026-08-25 14:16:33 +02:00
taro 2fca9406d7 Hide drop shadow window decoration when in fullscreen mode (#8449)
* Closes <https://github.com/emilk/egui/issues/8399>
* [x] I have followed the instructions in the PR template
2026-08-25 12:15:18 +00:00
Sylvain 144b1a1f83 eframe: apply ViewportBuilder::with_monitor on the glow backend (#8302)
## Problem

`ViewportBuilder::with_monitor(idx)` is a **no-op on the glow backend**.
A window
built with `.with_monitor(...)` opens on the default monitor, not
fullscreen —
while the exact same code works on wgpu.

The monitor → `Fullscreen::Borderless(Some(monitor))` resolution only
lives in
`egui_winit::create_window`, which the **wgpu** backend uses. The
**glow**
backend builds its windows straight from
`egui_winit::create_winit_window_attributes`
at two sites in `glow_integration.rs` — the initial window and
per-viewport
deferred windows — so the monitor is never applied there.

## Repro

A multi-viewport app on the glow renderer with any viewport built via
`ViewportBuilder::default().with_monitor(1)` opens that window on
monitor 0,
un-fullscreen. Switching to the wgpu renderer places it correctly. Seen
on a
3-monitor GNOME/Wayland setup where the main window and secondary
viewports all
need to land borderless-fullscreen on specific outputs.

## Fix

Extract the resolution into a public
`apply_monitor_to_window_attributes` in
`egui-winit` and call it from `create_window` (unchanged behaviour) plus
both
glow window-creation sites, so `with_monitor` behaves the same on glow
and wgpu.

No public API change beyond the new helper; no behaviour change on wgpu.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-08-25 14:07:33 +02:00
rustbasic 7aa7f84858 Fix transparent child viewports on Windows with glow (#8423)
Fix transparent child viewports on `Windows` with `glow`

* Closes #3632
* Related #4451
* Related #5072
* Closes #7543
* Related #8116


Transparent native child viewports could become opaque on Windows when
the
selected GL config reports that it does not support transparency.

`glutin_winit::finalize_window` clears the native transparent window
attribute
in that case. However, on affected Windows GL paths, transparent native
windows
and their GL surfaces still composite correctly.

This change preserves the transparent window attribute for explicitly
transparent non-root viewports on Windows by creating those windows
directly.

Tested manually on Windows with glow:
- root transparent viewport
- deferred native child viewport
- immediate native child viewport
2026-08-24 12:49:33 +02:00
Emil ErnerfeldtandClaude Fable 5 726b995608 Round the corners of the color picker (#8439)
The color picker's gradients and background checkers now follow the
style's corner radius, giving it a softer look.

This required changing the painting from being Mesh-based to being
texture-based

it's subtle with the default settings:

<img width="286" height="397" alt="Screenshot 2026-08-21 at 15 08 18"
src="https://github.com/user-attachments/assets/3a9d5289-71fb-4f34-8a20-1fe96891ba36"
/>


But you can [increase it](https://github.com/emilk/egui/pull/8445):


<img width="285" height="391" alt="Screenshot 2026-08-21 at 15 08 41"
src="https://github.com/user-attachments/assets/b0dfa7da-5b96-40e0-a80d-1da385d57a1a"
/>


### Before
for reference
<img width="286" height="392" alt="Screenshot 2026-08-21 at 19 08 27"
src="https://github.com/user-attachments/assets/7c754f36-795c-4381-9f9f-1fc8dd9a0264"
/>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 09:28:14 +00:00
Emil Ernerfeldt a15a7e6611 Increase widget corner radius to 4 (#8445)
A little more round and friendly!

* See also https://github.com/emilk/egui/pull/8439
2026-08-24 11:07:06 +02:00
97603fc082 Theme plugin system (experimental) (#8153)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/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!
-->

# What it does

Addition of a new system of theme plugins which allow the user to use
different rules engine to compute the style for the available
specialised widget style.

# How to use

Create a engine implementing the trait `ThemePlugin` and `ThemeStyle<S:
StyleStruct>` and implement the necessary methods, then register this
way (example for `ButtonStyle`):
```ui.add_theme::<ButtonStyle>(&mycustomengine);```

Now all button will call the `ThemeStyle<ButtonStyle>` method to compute the correct style and later use the cached value to avoid the costly computation.

If no valid `ThemeStyle<S>` or engine is available then it fallback to the default style.

* Closes part of <https://github.com/emilk/egui/issues/3284>
* [x] I have followed the instructions in the PR template

---------

Co-authored-by: adrien <221212@umons.ac.be>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2026-08-21 13:05:45 +00:00
Emil Ernerfeldt f5c9373e26 Add epaint::RoundedRect primitive (#8440) 2026-08-21 01:33:54 -07:00
Emil Ernerfeldt 00dc6e814b Make kittest's predictable texture filtering honor TextureOptions::NEAREST (#8441) 2026-08-21 01:33:29 -07:00
Keith 38c4ab7b3d Simplify and optimize Color32::from_rgba_unmultiplied (#8427)
So I first noticed that this function was using a large lookup table
behind a OnceLock. I initially thought about just making it a const, but
when looking at things further. I realized it could be made much
simpler.

If we just treated the numbers as fixed point we can get rid of any of
the floating point calculations and especially divisions. You can see
how efficiently this can compile down here:
https://llvm.godbolt.org/z/K83jEjvdq

You can see all three versions here: https://godbolt.org/z/nWc1as1nq
* First one is basically the original essentially being called by:
`ColorImage::from_rgba_unmultiplied()`
* Second is the const Lookup table instead of the OnceLock and runtime
generation.
* Third is the fixed point implementation.

At least looking at the bytes reported compiler explorer the OnceLock
and the const Table results are in similar size, and the const table is
surprisingly smaller when I compile to a binary object in compiler
explorer. However though the oncelock is producing a lot SIMD
instructions for initialization so I guess not too surprised. The fixed
point math is much smaller than both.

The const table is probably faster, but does bloat the binary images,
and again when it's this fast to compute:
https://llvm.godbolt.org/z/K83jEjvdq I am not sure the extra bytes are
worth it.

Next, what I did was merge `from_rgba_unmultiplied` and
`from_rgba_unmultiplied_const`. Moreover with the fixed point math the
`from_rgba_unmultiplied_const` is probably not necessary anymore, but
it's part of the public API so I left it. Lastly, I just added a sanity
test to make sure the math checks out which it does. You can even sweep
the 2^16 inputs to be sure.
2026-08-20 20:36:39 +00:00