Commit Graph
4634 Commits
Author SHA1 Message Date
Peder Bergan ae80c81ab7 Fix window resizing with clipped table content (#8517)
## Summary

Clipped table cells no longer contribute their overflowing content to a
sizing pass. Refresh non-resizable column widths during sizing so
clipped and truncated labels use the narrower available width when a
window is resized. Preserve minimum sizing for unclipped content and
full content measurements for column auto-sizing.

Fixes #8408.

## Testing

- Added sizing and window-drag regressions for exact, remainder, and
automatic columns and both strip directions, including unclipped and
explicitly truncated labels.
- Inspected headless wgpu renders during resizing; clipped/truncated
text and adjacent buttons remain correctly laid out.
- `cargo test --locked -p egui_extras -p egui --all-features --features
image/png,image/jpeg`
- `cargo clippy --locked -p egui_extras -p egui --all-targets
--all-features -- -D warnings`
- `cargo fmt --all --check`
- `python -X utf8 scripts/lint.py`
2026-10-06 06:53:29 +00:00
Tushar Sharma 68b739a19c docs: fix typo (#8553)
Found a small typo [while trying to work on another
issue](https://github.com/rerun-io/rerun/issues/12861#issuecomment-5622186483).
2026-10-06 06:49:48 +00:00
rustbasic aebc2d38c6 Preserve transparent viewport windows on Windows (#8616)
Preserve transparent viewport windows on Windows

Refactor window creation into create_window_for_viewport

## Description

`glutin_winit::finalize_window` may clear a window's requested
transparency when the selected GL config reports that transparency is
unsupported. On affected Windows GL paths, transparent native windows
and their GL surfaces may still composite correctly despite that report.

This can also cause a recreated root viewport to become opaque if its
transparent window is passed through `finalize_window`. Create
explicitly transparent Windows viewport windows directly instead,
including both root and child viewports. Keep using `finalize_window`
for opaque Windows windows and for windows on other platforms.

This extends the Windows workaround from the merged
[egui#8423](https://github.com/emilk/egui/pull/8423) to cover root
viewports, including when they are recreated.
2026-10-06 07:30:04 +01:00
Carmine Paolino 584fe1eb60 eframe: fall back to a compatibility-profile OpenGL context (#8655)
eframe's glow backend asks for OpenGL 3.3 core, then for OpenGL ES 2.0.
Some Windows drivers reject both: Intel HD Graphics 3000 offers OpenGL
3.1 and lacks WGL_EXT_create_context_es2_profile, so eframe fails to
start with "extension to create ES context with wgl is not present",
although egui_glow runs fine on that hardware. A user on Windows 10 1903
got 0xC0072095 for 3.3 core, then that error for ES.

This adds a last attempt: a compatibility profile without a minimum
version, which drivers answer with the newest version they support.
egui_glow already handles GLSL 1.20 and 1.40. Every failed attempt is
logged at warn and the last error is returned.

The attempts and the try-in-order loop are small functions with unit
tests.

* [x] I have followed the instructions in the PR template
2026-10-05 19:30:25 +01:00
n4n5andEmil Ernerfeldt d05898af9c feat: add more documentation on Image::texture_options (#8357)
* [x] I have followed the instructions in the PR template


<img width="1012" height="108" alt="image"
src="https://github.com/user-attachments/assets/abbabcff-55a3-4563-a2f2-9a39f811c696"
/>

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 18:05:17 +00:00
4eef030468 Fix typo in README (#8598)
"gitub pages" → "github pages".

---------

Co-authored-by: Londopy <Londopy@users.noreply.github.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 18:01:29 +00:00
Sylvain BennerandClaude Opus 5.5 f22d05b27a Make Areas::set_state public (#8645)
I'm working on an open-source UI toolkit that uses egui as one of its
backends, and I'd like to propose a few small patches. This is the
second one.

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

`Memory::layer_id_at`, which decides who gets the hover and the scroll
wheel, only finds layers that have an area state, and only `Area` can
set one. A layer an integration places itself, for instance with
`UiBuilder::layer_id` and `Context::set_transform_layer`, is skipped, so
the wheel and hover fall through to whatever is behind it.

This PR:

- makes `Areas::set_state` public (`AreaState` and `Memory::areas_mut`
already are);
- documents it: call it every pass the layer is shown, with the layer's
rect and whether it is interactable;
- adds a test, `set_state_makes_layer_hit_testable`: a layer registered
with `set_state` is returned by `layer_id_at` over its rect, and no
longer once it stops being registered.

Note about why not use an `Area`: it lays out its own content, and the
first time it is shown it does an invisible, non-interactable sizing
pass and asks for another repaint. A UI that has already measured and
placed its popup, such as a menu or popover, doesn't need that.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 18:54:06 +01:00
n4n5 8daf162b04 feat: add utils methods to Rect (floor, round, ceil) (#8654)
<!--
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!
-->

Add same method like `Pos2` and `Vec2`: `floor()`, `round()`, `ceil()`

* Closes <https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE>
* [x] I have followed the instructions in the PR template
2026-10-05 18:53:06 +01:00
Sylvain BennerandClaude Opus 5.5 6cc93764f8 Add Context::set_repaint_observer (#8644)
I'm working on an open-source UI toolkit that uses egui as one of its
backends, and I'd like to propose a few small patches. This is the first
one.

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

The callback set with `Context::set_request_repaint_callback` is only
called when a request makes the next repaint of a viewport come sooner.
So an integration can't see everything that was requested during a pass:
a `request_repaint_after(2s)` after a `request_repaint_after(1s)`, or
any request while an immediate repaint is already pending, never reaches
it. `ViewportOutput::repaint_delay` only has the soonest of all
requests, merged with egui's own follow-up repaint after input, and
`Context::repaint_causes` has no delays.

This PR:

- adds `Context::set_repaint_observer`, an optional second callback that
gets the same `RequestRepaintInfo` for every repaint request, on the
thread that made it;
- leaves the request callback and its throttling (#2126) unchanged, so
no integration gets more wakeups, and costs nothing when no observer is
set;
- adds a test, `test_repaint_observer_sees_every_request`: it requests a
repaint after 1 s, then after 2 s, and checks that the callback only
sees the first request while the observer sees both.

An integration can use the observer to schedule its own frames from what
the app actually asked for (for example, to settle an input in a single
pass instead of the usual follow-up passes), or to count repaint
requests in tests.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 18:51:11 +01:00
Peder Bergan a6f28482c1 Add RichText::color_override to read the explicit text color (#8564)
Expose the optional color set by `RichText::color()` so callers can read
it without keeping duplicate state. `color_override()` returns the
explicit override; theme and widget color resolution remain unchanged.

* Closes <https://github.com/emilk/egui/issues/7267>
* [x] I have followed the instructions in the PR template
2026-10-05 17:48:29 +00:00
Ted LandClaude Opus 5.5 a6a2d6c4b4 Don't start a CJK row with full-width closing punctuation (#8658)
* Closes <https://github.com/emilk/egui/issues/8659>
* [x] I have followed the instructions in the PR template

`is_cjk_break_allowed` keeps closing marks off the start of a row, but
it only lists the ASCII and Japanese forms. Chinese writes full-width
ones, so wrapped Chinese text could start a row with `,`. This adds the
full-width forms (`!%),.:;?]`) and the closing quotes and ellipsis
Chinese uses (`” ’ …`), from [Wikipedia's
list](https://en.wikipedia.org/wiki/Line_breaking_rules_in_East_Asian_languages#Characters_not_permitted_on_the_start_of_a_line),
with a test that wraps a Chinese line at every few-glyph width (it fails
without the change).

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

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 18:45:02 +01:00
Matt KeeterandEmil Ernerfeldt 9f574b6f16 Show menu without a click if another menu is open (#7802)
<!--
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!
-->

https://github.com/emilk/egui/issues/4607 accidentally removed the
behavior where – once a menu is open – moving the mouse to another menu
opens that one instead (on hover, without requiring a click). This is a
pretty easy fix!

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

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 19:37:31 +02:00
Vladyslav BatyrenkoandEmil Ernerfeldt 30639ace4d Fix popups immediately closing on mouse button release (#7624)
<!--
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!
-->

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

The PR makes it so a popup is closed on a press of a button but not
click (i.e. release) of a button - this fixes the issue of a popup
immediately closing after releasing a button.

I can reproduce the issue with the following code in `bevy_egui`:

```rust
    let popup = egui::Popup::new(
        egui::Id::new("A unique popup"),
        ctx.clone(),
        egui::PopupAnchor::PointerFixed,
        egui::LayerId::new(egui::Order::Foreground, egui::Id::new("popup layer")),
    );

    let mut open_command = None;
    for message in mouse_button_input_reader.read() {
        if message.state.is_pressed() && message.button == MouseButton::Right {
            open_command = Some(SetOpenCommand::Bool(true));
        }
    }

    popup.open_memory(open_command).show(|ui| {
        ui.label("This is a popup");
    });
```

When a popup is open due to a "press" event, it will get closed on the
next "release" event (as they aren't likely to happen at the same
frame). One could argue that the intended usage here is to open a popup
only on a release of a button, but for users that have it open on a
button press the current `egui` behavior could be counterintuitive.

I haven't tested this extensively, but if you find that this fix breaks
any other behavior or some intended design where we do expect a popup
close only on a button release, feel free to close this.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 16:43:49 +02:00
rustbasic 7a911a1e1c Enable mouse wheel scrolling while dragging inside a ScrollArea (#7919)
Enable mouse wheel scrolling while dragging inside a `ScrollArea`

### Problem  
When the pointer button is held down and a widget inside a `ScrollArea`
is being dragged (e.g. selecting text in `TextEdit`), mouse wheel
scrolling does not work. This happens because `ScrollArea` only
processes mouse wheel scrolling when `ctx.dragged_id().is_none()`, i.e.
when no widget is currently being dragged.

### Change  
Relax the wheel-scrolling gating condition so that wheel scrolling is
allowed whenever the pointer is over the scroll area (or when
background-drag scrolling is active), even if another widget is
currently being dragged.

Concretely, we replace the `dragged_id().is_none()` requirement for the
mouse wheel path with:

- `pointer_over_outer = ui.rect_contains_pointer(outer_rect) ||
is_dragging_background`
- Use `pointer_over_outer` to decide whether to apply wheel scrolling

### Result  
- Wheel scrolling works while dragging/selecting within widgets inside a
`ScrollArea` (notably `TextEdit`).
- This matches common desktop editor behavior: drag-select while
wheel-scrolling to extend selection.

### Notes / Potential behavior change  
This enables wheel scrolling during any active drag (not only
`TextEdit`), as long as the pointer is over the `ScrollArea`. If
maintainers prefer limiting this to specific widgets (e.g. only text
selection), we can follow up with a more targeted approach (e.g. an
explicit option/flag).

**Files changed**  
- `scroll_area.rs` (wheel scrolling hover gating logic)
2026-10-05 14:21:40 +00:00
rustbasicandEmil Ernerfeldt d4735653c7 Fix : an issue where double-clicks were judged as triple-clicks. (#7915)
Fix : an issue where double-clicks were judged as triple-clicks.

Fixed an issue where a double-click was sometimes recognized as a
triple-click.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 14:08:29 +00:00
Emil Ernerfeldt 54414baaf7 Only treat Cmd+X/C/V without extra modifiers as cut/copy/paste (#8668)
Supersedes #7671 by @drewmiller (thanks!), implementing the
`command_only` suggestion from review.

In `egui-winit`, `Event::Cut`/`Copy`/`Paste` are now only emitted when
Cmd/Ctrl is held **without** Shift or Alt. Shortcuts like Cmd+Shift+V,
Cmd+Alt+V, Cmd+Shift+C (and their Ctrl equivalents) are now passed
through as normal key events, so apps can bind them to e.g.
paste-as-plain-text.

Unchanged: the dedicated Cut/Copy/Paste keys, and Shift+Delete /
Ctrl+Insert / Shift+Insert on Windows.

Note: on Linux this means Ctrl+Shift+C/V (terminal-style) no longer
copy/paste into egui text fields.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-10-05 14:01:31 +00:00
rustbasic 66092f4349 Save window settings only from the root viewport (#8661)
## Summary

Only the root viewport now provides window information to the native
autosave flow.

## Details

When a deferred viewport autosaves, its window size and position could
overwrite the settings used to restore the root window on the next
launch. This change passes window information to autosave only for the
root viewport in both the Glow and WGPU integrations.

Autosaving application state and egui memory remains enabled for
deferred viewports.
2026-10-05 14:57:01 +01:00
GavinPizza 6525ca0d34 Fix AccessKit ScrollIntoView for a Ui with UiBuilder::sense (#8646)
AccessKit's `ScrollIntoView` (and kittest's `Node::scroll_to_me`) did
nothing for a `Ui` created with `UiBuilder::sense`, e.g. via
`ui.scope_builder`.

`Ui::new` registers the `Ui` with `Rect::NOTHING`, then
`remember_min_rect` registers it again with its real rect.
`Context::create_widget` consumed the `ScrollIntoView` request on the
first call, so it scrolled to an empty rect and the request was gone by
the second call.

`create_widget` now leaves action requests alone while the rect is
`Rect::NOTHING`, so they are handled once the real rect is known. `Drop
for Ui` always calls `remember_min_rect`, so a request is never left
unhandled.

Added `sensed_ui_can_be_scrolled_into_view` to
`egui_kittest/tests/accesskit.rs` (fails without the fix).

* [x] I have followed the instructions in the PR template
2026-10-05 15:53:44 +02:00
Wu Shuwen 8de976f4bf Fix #8495: Match scrollbar interaction rect to drawn bar rect (remove dead zone) (#8635)
Closes #8495.

## Problem

`ScrollArea::scroll_bar_rect` is used when painting the scrollbar
(`outer_scroll_bar_rect` at lines 1360-1364) and when computing handle
geometry/travel (`from_content`, `handle_travel`), but the interaction
rect `max_bar_rect` (lines 1318-1322) was derived from `outer_rect`
along the scrolling axis.

When a caller passes a `scroll_bar_rect` smaller than `outer_rect` (as
`egui_table::SplitScroll` does to keep bars out of sticky row/column
regions), the two rects disagree along the scroll axis. Consequences:

1. A press in the region where no scrollbar is drawn is sensed as a
scrollbar press and snaps the offset to the minimum.
2. During a drag, that region behaves as a dead zone because
`scroll_start_offset_from_top_left` is latched for the whole drag and
the offset is pinned until the pointer crosses back into
`handle_travel`.

## Fix

Changed `max_bar_rect` to use `scroll_bar_rect.x_range()` for horizontal
bars and `scroll_bar_rect.y_range()` for vertical bars along the
scrolling axis, while keeping the existing cross-axis positioning
(`max_cross`, `full_width`, and the clip-rect adjustment that moves bars
into view).

The interactive region now matches the painted bar and handle travel
exactly. The default case (`scroll_bar_rect` is `None`, which resolves
to `inner_rect`) is unchanged in behavior since `inner_rect` and
`outer_rect` share the same min along the scroll axis (only the far edge
differs for scroll bar space).

- [x] `cargo check -p egui` and `cargo test -p egui` pass.
2026-10-05 13:52:23 +00:00
Douglas DwyerandClaude Sonnet 5 e490c0482b Fix: Panel/Scene clip rect should respect parent (#8562)
## Summary

Right now, `Panel`s and `Scene`s override the clip rect of their parent
container. This results in "overflow" during the window collapse
animation:


https://github.com/user-attachments/assets/453b6089-0312-4dc9-ac18-28d36ae66e13

This PR makes the clip rect intersect with the outer container, so that
the content is properly hidden:


https://github.com/user-attachments/assets/692db0eb-66c6-41d2-9ea6-e53c7733ef91

### Changes

- Modify `panel.rs` to use `intersect` when calling `set_clip_rect`
- Modify `scene.rs` to use `intersect` when calling `set_clip_rect`

<!--
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!
-->

* No associated issue that I could find
* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 15:49:45 +02:00
Ori SkyandLucas Meurer 37b796dcb2 Remove unfocusable widgets from the widget cache (#8653)
This patch fixes the issue raised in #8652 whereby focusable widgets
that have been disabled still remain in the focus widget cache and can
be navigated to via the directional keys.

The fix adds a new function `ignore_focus` to `Memory` that does the
same as `surrender_focus` but additionally removes the widget in
question from `focus_widgets_cache`. `Context::create_widget` is updated
to call this function instead of `surrender_focus`.

A regression test is added to guarantee this behaviour. The test sets up
two buttons and a checkbox to enable/disable the first button. When the
first button is disabled, the arrow down/up keys are tested to ensure
that focus skips over the button.

<!--
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!
-->

* Addresses and resolves
<https://github.com/emilk/egui/discussions/8652>
* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2026-10-05 13:46:50 +00:00
3276381389 Fix changing widget IDs and false-positive ID change warnings across passes (#8316)
- [x] I have followed the instructions in the PR template

Closes #8092.
Related to #8084.

Virtualized tables could shift the parent UI's automatic ID sequence
between sizing and rendering passes.

`StripLayout::skip_space` represented non-visible rows using
`allocate_rect(..., Sense::hover())`. This preserved the scroll extent,
but also registered a hover widget and consumed an automatic widget ID.
When virtual buffers differed between passes, subsequent table widget
IDs changed and triggered warnings such as:

> Widget rect changed id between passes

Multi-pass and data-driven layouts can also legitimately move existing
widgets into vacated rects or intentionally replace all widgets within a
region. These cases could produce the same warning even though the
widget IDs were stable or the replacement was intentional.

This PR:

- uses `expand_to_include_rect` for virtual row buffers, preserving the
scroll extent without registering a widget or consuming an automatic ID;
- assigns deterministic IDs to table header, body, and cell UIs;
- avoids warnings when an existing widget moves into a rect vacated
during the previous pass, while retaining warnings for genuinely new IDs
replacing widgets in place;
- adds `Context::allow_widget_id_changes_in` as a pass-local,
rect-scoped exclusion for regions that intentionally replace their
widget set;
- adds regression coverage for virtual spacer extent, automatic ID
preservation, moved widgets, genuine replacements, and scoped
exclusions.

There are no intended visual changes. The only public API change is
`Context::allow_widget_id_changes_in`, which affects this diagnostic
only; it does not change duplicate-ID checks or widget interaction.

### Testing

Verified locally with Rust 1.95.0:

- `cargo fmt --all -- --check`
- `python3 scripts/lint.py`
- `RUSTFLAGS="-D warnings" RUSTDOCFLAGS="-D warnings" cargo test -p egui
-p egui_extras --all-features --features image/png,image/jpeg --locked`
- `RUSTFLAGS="-D warnings" cargo clippy -p egui -p egui_extras
--all-targets --all-features --locked -- -D warnings`
- `RUSTFLAGS="-D warnings" cargo clippy -p egui -p egui_extras
--all-targets --all-features --release --locked -- -D warnings`

87 unit tests and 193 doc-tests passed; one existing doc-test is
ignored. The test command explicitly enables PNG/JPEG codecs required by
the image-loader fixtures.

Screenshots are not applicable because these changes do not affect
visual output.

---------

Co-authored-by: lucasmerlin <hi@lucasmerlin.me>
Co-authored-by: wfp-codex-bot <wfp-codex-bot@vlans.co>
2026-10-05 15:37:52 +02:00
benliepertandEmil Ernerfeldt 2b7816fd5f Minor spelling/grammar updates in egui_kittest's README (#7644)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 13:03:44 +00:00
21434b3202 Add feature for supporting raster images in svg (#8139)
<!--
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!
-->

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

SVG supports inlining raster images (PNG/JPEG), `egui-extras` as it
stands does not support this.

`resvg` has a feature for this, it's just a matter of enabling it, this
PR adds an `egui-extras` feature `svg_images` doing exactly that.

---------

Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 12:58:38 +00:00
SuchAFuriousDeathandEmil Ernerfeldt 36aa2932db Make Clipboard::new unsafe (#7826)
The smithay-clipboard Clipboard::new method requires the display pointer
to remain valid for the lifetime of the Clipboard. Since egui-winit's
Clipboard::new cannot guarantee this invariant, it must be marked unsafe
and pass the safety requirement to the caller.

Fixes #7743 (more details there)

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

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 12:55:40 +00:00
4bbd125452 Add Keys specific to Windows & Mac keyboards (#8373)
Add 25 new key variants to the Key enum to cover standard multimedia,
browser, launch, and Mac-specific keys:

- Browser keys: BrowserForward, BrowserRefresh, BrowserSearch,
BrowserHome, BrowserFavorites, BrowserStop
- Media keys: MediaPlayPause, MediaTrackNext, MediaTrackPrevious,
MediaStop, AudioVolumeMute, AudioVolumeDown, AudioVolumeUp
- Launch keys: LaunchMail, LaunchApp1, LaunchApp2
- Mac/system keys: Fn, Eject, Help, Power, Sleep, Clear
- Lock keys: CapsLock, NumLock, ScrollLock, PrintScreen, Pause, Menu

Also fix the 'Help' key name conflict - previously 'Help' was mapped to
Key::Insert, now it correctly maps to the new Key::Help.

<!--
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!
-->

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

---------

Co-authored-by: ans1ble <ans1ble@users.noreply.github.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 12:55:06 +00:00
Tristan117andEmil Ernerfeldt e145cd59a2 Add option ``scroll_zooms` for mouse wheel to zoom instead of scroll inside a `Scene`` container (#7891)
Closes <https://github.com/emilk/egui/issues/7650>
[ X] I have followed the instructions in the PR template

Previously submitted as <https://github.com/emilk/egui/pull/7666> but
replaced to clean up the git history.

This feature allows building image viewers and similar applications
using a `Scene` container where the desired mouse wheel input without a
modifier is to zoom rather than scroll/pan.

Alternatives considered:

Swap zoom and scroll variables used in `Scene`
- Would cause touch input zoom to scroll/pan instead which would be
inconsistent with standard user interface interaction
- This also means there is no simple way to swap zoom and vertical
scroll modifiers for this use case e.g. ctrl+mousewheel pans vertically
while mousewheel alone zooms.
- What is implemented results in ctrl-mousewheel and mousewheel only
being identical inputs.

Modify `ctx.option.zoom_modifier`
- Doesn't work because `Modifiers:NONE` never matches to anything (and
therefore disables mouse wheel zoom globally).
- Refactoring this to provide a different option per container is a
large amount of work and does not seem to be a use case that is likely
to be used outside of `Scene`

The logic used inside `Scene` to achieve this is fairly simple and only
adds one extra dependency on `input_options.scroll_zoom_speed` to ensure
that the zoom speed setting change is consistent across the application.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 12:54:58 +00:00
Oscar GustafssonandEmil Ernerfeldt 2078a31e09 Replace constant divisions with constant multiplications (#8412)
<!--
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!
-->

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

Compiler optimization will replace these later on, but when building
without optimization they will (most often) stay divisions and divisions
are clearly slower than multiplications.

Note that the `/ 2.5` replacement is not bit-exact (since 0.4 cannot be
represented exactly, but 2.5 can), but my guess is that the
approximation is good enough. The others should be bit-exact.

(Division by 2 for unsigned numbers will be replaced to >>1 earlier in
the compile chain, so no point in doing the same there.)

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 12:44:07 +00:00
rustbasicandEmil Ernerfeldt 5c84b98973 Fix: Refresh Windows title bar after theme changes (#8402)
Fix: Refresh Windows title bar after theme changes

**Description**

On Windows, changing the window theme updates egui immediately, but the
native title bar may keep its previous colors until the window
activation state changes.

This sends WM_NCACTIVATE after applying ViewportCommand::SetTheme,
forcing Windows to refresh the non-client title bar state without
changing the real focus.

* Related #8299

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 12:42:39 +00:00
SylvainandEmil Ernerfeldt 08bb79f68d eframe: use the activation token from the environment on window creation (#8406)
- related #8282 
- part of https://github.com/emilk/egui/issues/8142

A desktop entry with `StartupNotify=true` hands the launched process an
activation token through `XDG_ACTIVATION_TOKEN` (Wayland) or
`DESKTOP_STARTUP_ID` (X11). winit can apply one, but only at window
creation, via `WindowAttributesExtStartupNotify::with_activation_token`.
eframe never reads it, so the token our launcher went to the trouble of
issuing is thrown away.

winit's own docs are blunt about the consequence:

> The `ActivationToken` is essential to ensure that your newly created
window will obtain the focus, otherwise the user could be required to
click on the window.

That is what I ran into: under Mutter the window opens unfocused and
cannot recover, since `ViewportCommand::Focus` is precisely the request
focus-stealing prevention blocks. On a kiosk-style setup the cost goes
past a missing title-bar highlight — a compositor only grants a pointer
constraint to a focused surface, so `CursorGrab` silently does nothing
too.

This reads the variable when building the window attributes and passes
it to winit. The environment is cleared afterwards through winit's
`reset_activation_token_env()`, per the startup-notification spec: a
token is single-use, and leaving it around would have every later
viewport, and every child process, replay it.

Linux only, behind the existing `wayland`/`x11` features; a no-op when
the variables are absent.

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-10-05 13:35:15 +01:00
the-maddin 7a7068a17e Clarify wording of IdTypeMap::remove_by_type documentation (#8364)
The function to remove all entries of a type from IdTypeMap was
confusingly documented as "Note all state of the given type".
As far as I know, (not a native speaker), "noting" shares no meaning
with "removing", so I changed the doc to simply state what the function
does.
2026-10-05 13:33:53 +01:00
Emil Ernerfeldt 85f1a57719 Rubber-band when drag-scrolling past the edge of a ScrollArea (#8663)
* Follows #8665
* Follows #8662

Content can now be pulled past the edge of a `ScrollArea` with
increasing resistance, and springs back when released, like iOS/macOS. A
flick that coasts into the edge bounces too.

**Input paths**
* **Drag-to-scroll** (touch): rubber-bands on drag, bounces on kinetic
coast.
* **Trackpad, fingers down**: rubber-bands mid-gesture, holds while
fingers rest, springs back on lift.
* **Trackpad, OS momentum phase** (macOS): bounces once off the edge,
then the rest of the momentum is ignored. Momentum arriving while
already past the edge is ignored, so it doesn't overshoot.
* **Mouse wheel / web** (no phases): still hard-clamps, like macOS.
* Scroll bars and `scroll_to_*` unchanged.

**Scroll chaining** is preserved: an inner scroll area already at its
edge when a trackpad gesture starts passes the delta to an enclosing
scroll area. The outermost area rubber-bands at its edge.

**Structure**: `scroll_physics.rs` holds the maths (iOS resistance
curve, exact critically damped spring, exact kinetic decay) and the
per-axis rules (`drag`, `step`, `wheel`) as a 1D stateless
`AxisPhysics`, with unit tests. `scroll_area.rs` keeps only the glue:
build the per-axis physics, call one method per input path, remember
which axes to leave unclamped this frame.

**API**
* `State::offset` is now private, since it may be outside the valid
range while rubber-banding. Read it via `State::clamped_offset()` (what
the old field used to be) or `State::unclamped_offset()` (where the
content is drawn), plus `State::overscroll()`. A deprecated
`State::offset()` returns the clamped one. `State::velocity()` is now in
offset space (positive = scrolling down/right).
* `KineticScrollStyle::rubber_band: bool` to turn it off. Slope (0.55)
and spring time (0.1 s) are constants.

**Tests**: 8 unit tests on the physics and rules (resistance curve,
spring, coast distance, frame-rate independence, chaining, momentum
bounce-once and no-overshoot), plus one kittest test wiring a touch drag
through `ScrollArea`.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-10-05 13:59:11 +02:00
c60308f35f Bump accesskit{,_consumer,_winit} to latest versions. (#8496)
Also make some minor code changes because some structs have been renamed
in `accesskit` and `accesskit_consumer`.

As of today, this requires patching kittest, which has a commit bumping
its version of accesskit_consumer that isn't in a release yet.

I don't mind holding off on landing this for a little bit to see whether
they'll release a new version soon, if you prefer.

* (No issue, since this seems pretty small, but happy to file one if you
like)
* [x] I have followed the instructions in the PR template

---------

Signed-off-by: Alice Boxhall <alice@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2026-10-05 13:57:14 +02:00
Emil ErnerfeldtandClaude Opus 5.5 4fd6f81d5d Keep tooltips open while holding all modifiers to inspect widgets (#8639)
When `debug_on_hover_with_all_modifiers` is enabled, holding down all
modifier keys lets you hover widgets to see where they were created.
Previously this didn't work for tooltips, since moving the pointer
towards a tooltip would close it.

Now, while all modifiers are held:
* An open tooltip stays open
* The tooltip is made interactable, so its contents can be
hovered/inspected
* Tooltips shown `at_pointer` freeze in place instead of following the
pointer

Includes a regression test.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 12:02:31 +02:00
Emil Ernerfeldt e45775e450 Add MouseWheelSource and InputState::scroll_source() (#8665)
Lets you tell what is driving a scroll: a mouse wheel, fingers on a
trackpad (not a touch screen), or the OS continuing a trackpad swipe
with momentum.

```rust
pub enum MouseWheelSource {
    Unknown,
    Wheel,
    Trackpad,
    Momentum,
}
```

* `Event::MouseWheel` gains `source: MouseWheelSource`. Integrations set
it to `Unknown` if they don't know.
* `InputState::scroll_source() -> Option<MouseWheelSource>`: what is
driving the current scrolling, `Some` while `is_scrolling()`. For a
trackpad that covers the whole gesture (`TouchPhase::Start`…`End`); for
a mouse wheel, until the smoothing of the last notch is done. Touch
screens scroll by dragging with the pointer, not with wheel events, so
`None` there.

Use cases: a `ScrollArea` can rubber-band and hold while fingers rest on
the trackpad, but bounce during momentum (#8663, built on this). A
slider or plot can ignore `Momentum` so a flick doesn't keep changing a
value after the fingers lift.

**Where the source is known**
* macOS (eframe): `Wheel`, `Trackpad` or `Momentum`. winit folds the
macOS momentum phase into the regular `TouchPhase`, so egui-winit reads
`NSEvent::momentumPhase` itself through a local event monitor
(`macos_scroll_momentum.rs`, owned by `State`, removed on drop). Precise
deltas are `Trackpad`, line deltas `Wheel`. Goes away once we are on a
winit with rust-windowing/winit#4732; marked with TODOs.
* winit `PanGesture`: `Trackpad`.
* Everywhere else: `Unknown`. Web `WheelEvent`s carry no phase or source
at all.

**Also**: the 150 ms scroll-action timeout from #8636 is tuned for
flowing events. Fingers resting on a trackpad produce none, so a known
`Trackpad` gesture now survives a 1 s gap before being considered over.
The enum mirrors the one proposed for winit.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-10-04 18:45:20 +00:00
Suliman Abdulrazzaq 69a8b71eb5 Fix scroll modifiers getting stuck when TouchPhase::End never arrives (#8636)
* Closes <https://github.com/emilk/egui/issues/8325>
* Closes <https://github.com/emilk/egui/issues/8443>
* [x] I have followed the instructions in the PR template

winit on Wayland sends `TouchPhase::Start` for some mouse wheels, but
never `TouchPhase::End` (winit's own comment in its Wayland pointer
handler: "the `Ended` is not guaranteed to be sent for mouse wheels").
Since #7678, `WheelState` then stays `InTouch` for good, and in
`InTouch` the modifiers are only ever added to. So after a single
ctrl+scroll, every later scroll is a zoom, which is what #8325 bisected
to 1b77d7047. `is_scrolling()` also stays `true`, and with
`show_tooltips_only_when_still` that keeps tooltips from showing.

This ends an `InTouch` scroll action after 150 ms without scroll events,
the same timeout `Smoothing` already uses. The check runs in
`after_events`, and also when the next wheel event arrives, because an
idle app may not run a pass after the timeout has passed. While events
keep coming, the modifiers stay latched as #7678 intended.

Tests, in `wheel_state.rs`:
* `modifiers_should_not_stick_when_touch_phase_end_never_arrives`:
`Start`+`Move` with ctrl, then 1 s later a `Move` without ctrl. Before
the fix it zoomed (`left: 0.9753099`, `right: 1.0`).
* `scroll_action_should_end_when_touch_phase_end_never_arrives`:
`is_scrolling()` is `false` after a second without scroll events. Before
the fix it stayed `true`.
* `modifiers_should_stick_until_touch_phase_end`: letting go of shift
mid-scroll still scrolls horizontally until `End` (the #7678 behavior).
Passes before and after.

`cargo test -p egui --all-features` passes (75 unit tests, 186
doc-tests), and so do `cargo fmt`, `./scripts/lint.py`, `cargo clippy -p
egui --all-features --all-targets -- -D warnings` and `cargo doc -p egui
--document-private-items`. The whole-workspace `cargo test
--all-features` on macOS (with the snapshot tests) passes too. I don't
have a niri or COSMIC setup, so the tests replay winit's event sequence
rather than a real wheel.
2026-10-04 20:25:31 +02:00
Emil Ernerfeldt 23348e9fa7 Make kinetic scrolling feel like iOS (#8662)
Kinetic (momentum) scrolling after a drag used a constant deceleration
(Coulomb friction), so coast distance was proportional to velocity².
Fast flicks flew way too far, slow flicks died instantly.

This switches to exponential velocity decay like `UIScrollView` on
iOS/macOS:

```
v(t) = v₀ · exp(-t / decay_time)
```

Coast distance is `v₀ · decay_time`, i.e. linear in release velocity.
Default `decay_time = 0.5 s`, matching
`UIScrollView.DecelerationRate.normal` (0.998/ms). Integration is exact
per frame, so the result is frame-rate independent.

| release velocity | before | after |
|---|---|---|
| 300 pt/s | 45 pt | 150 pt |
| 1000 pt/s | 500 pt | 500 pt |
| 2000 pt/s | 2000 pt | 1000 pt |
| 4000 pt/s | 8000 pt | 2000 pt |

The constants are exposed in the new `KineticScrollStyle` at
`Style::spacing.scroll.kinetic` (`decay_time`, `stop_distance`), with a
UI in the style settings. `decay_time = 0.0` disables kinetic scrolling.

Only affects drag-to-scroll (touch / mouse drag). Trackpad momentum on
macOS comes from the OS and is unaffected.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-10-04 14:14:41 +02:00
Emil ErnerfeldtandClaude Fable 5.1 6b420bc1b1 Replace #[test] Send + Sync assertions with compile-time const asserts (#8649)
This ensures they hold on wasm32 too

* See https://github.com/emilk/egui/pull/8638

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-29 17:11:39 +00:00
Teo Mal e9f2025890 Keep egui::Context Send + Sync with wasm threads (#8638)
With wasm threads, `DroppedFileHandle` wasn't `Send + Sync`, so neither
was `Context`, which holds the dropped files.
That broke `egui_extras`'s `http` loader and any code moving a `Context`
to another thread, and contradicts the `context_impl_send_sync` test.
`DroppedFileHandle` is `Send + Sync` everywhere again, and eframe wraps
the `web_sys::File` in a `SendWrapper` (new dependency, `send_wrapper`
0.6).

Checked: the command from the issue, the `check_wasm_atomics` CI
command, and the regular wasm32 build of `egui_demo_app`.

This partly reverts the design of #8354, cc @grtlr.

Fixes #8401
2026-09-29 16:58:23 +00:00
Emil ErnerfeldtandClaude Opus 5.5 ee9cc58c80 Add JSON to the simple syntax highlighter in egui_extras (#8632)
`egui_extras`' built-in highlighter (used when the `syntect` feature is
off, e.g. by `egui_commonmark` without `better_syntax_highlighting`) now
highlights `json` code blocks: strings, numbers, and the
`true`/`false`/`null` keywords.

This came up in the Rerun Viewer's agent panel, where JSON code blocks
rendered as plain text.

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

🤖 This PR was written by Claude, an LLM, on behalf of @emilk.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 09:50:32 +00:00
Emil ErnerfeldtandClaude Opus 5.5 6e35807686 Style tweak: slightly roomier buttons (#8617)
### Before
<img width="380" height="523" alt="image"
src="https://github.com/user-attachments/assets/f0ea9470-2090-4ebf-8170-4e26f9a1c83b"
/>

### After
<img width="380" height="564" alt="image"
src="https://github.com/user-attachments/assets/fd7b2b2c-1f95-4af7-9e22-6112ed560b4b"
/>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 10:16:12 +02:00
Emil ErnerfeldtandClaude Opus 5.5 8a4b632f34 Fix TextEdit layout shift with custom margin; unclipped TextEdit grows to fit text (#8628)
Broken out of #8617.

* `TextEdit::margin` now makes room for the stroke inside the margin
(like the theme does), so the stroke width changing on hover/focus no
longer causes a layout shift.
* `TextEdit::clip_text(false)` now expands the widget to make all text
visible, as documented, instead of being capped at `desired_width`.
* The default `TextEdit` inner margin is now `spacing.button_padding`,
and the theme gives `TextEdit` the same min height (`interact_size.y`)
as a `Button`, so they always have the exact same height (previously off
by 1px).

Tests added to `test_widget_heights.rs`: text edit included in the
matching-heights test (now run for several `interact_size.y` values),
size stable on hover/focus (with and without custom margin), and
unclipped text edit grows to fit text.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 08:04:34 +00:00
Suliman Abdulrazzaq 7eb71da0bd Fix DragValue reporting changes while typing with update_while_editing(false) (#8627)
* Closes <https://github.com/emilk/egui/issues/7837>
* [x] I have followed the instructions in the PR template

With `update_while_editing(false)`, the value of a `DragValue` is only
updated once editing is done, but `response.changed()` was still `true`
on every keystroke. While the widget is focused, its response is the
inner `TextEdit` response, and a `TextEdit` marks every text edit as a
change.

The fix clears that flag in the text-edit branch. The existing check at
the end of `DragValue::ui` already marks the response as changed when
the value actually changed, so `changed()` now means "the value
changed", in both modes. `Slider` and `RangeSlider` take their value
box's response via `union`, so they get the same fix.

Tests (in `egui_kittest/tests/regression_tests.rs`):
*
`drag_value_should_not_report_changes_while_typing_without_update_while_editing`:
typing `42` reports no change, and pressing Enter reports exactly one
change, with the value `42`. Without the fix, this fails with 2 changes
while typing and the value still at `0`.
*
`drag_value_should_report_changes_while_typing_with_update_while_editing`:
with the default setting, each keystroke still reports a change.
2026-09-25 08:04:03 +00:00
Emil ErnerfeldtandClaude Opus 5.5 7903bf6c4e kittest: mention how to disable the accessibility check in its failure message (#8630)
Broken out of #8617.

The panic message now points to
`HarnessBuilder::with_accessibility_check(false)`.

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

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 09:51:12 +02:00
b689ffde5b Use arboard if smithay does not find text in the clipboard (#8624)
Fallback to `arboard` with `wayland-data-control` if `smithay` does not
find a text MIME type in the clipboard.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 14:23:35 +00:00
Emil ErnerfeldtandClaude Opus 5.5 fe6d63efa4 Fix exponential memory use of the debug Id source tracker (#8619)
* Closes #8558

In debug builds, each `Id`/`IdSalt` stores its `Debug`-formatted source
chain. Using an `Id` as a salt copies its whole chain into the child.
`CollapsingHeader` does `ui.indent(header_id, …)`, where `header_id` is
derived from the parent `Ui` id, so the stored string doubles at every
level of nesting (≈640 kB at depth 11, and it keeps doubling).

The fix caps stored sources at 1024 bytes. It keeps the end, since that
is the most specific part.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 14:04:32 +02:00
Lucas MeurerandClaude Opus 5 bc94cac5a7 Respect the menu style config in sub menus (#8572)
Previously it was ignored since menu_style was applied within `Popup`
and the frame was created on the previous, unchanged outer ui.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-24 12:03:07 +00:00
Lucas MeurerandClaude Opus 5 ab7d768a80 Allow transforming after shapes were tessellated and rounded (#8587)
Via a new `TransformedShape`. When the transform is applied before
rounding during an animation, it introduces a ugly snap once the
transform ends:


https://github.com/user-attachments/assets/1e75cd21-4bc4-4869-b3fa-cde749991518

When the transform is applied after rounding it looks way smoother:


https://github.com/user-attachments/assets/ccba1562-66dc-4b93-b187-53928510c0b8

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-24 11:02:47 +00:00
Emil ErnerfeldtandClaude Opus 5.5 160090b20a Don't lose keyboard focus in a pass that will be discarded (#8623)
* Follow-up to https://github.com/emilk/egui/pull/8621

`Ui::is_visible` is `false` for the rest of a pass once anything calls
`request_discard` (see `Context::will_discard`).
#8621 made invisible widgets not interested in focus, so a focused
widget drawn after any `request_discard` call would give up its focus,
and it stays lost because `Memory` persists across passes.

In Rerun this showed up as a focused list item losing focus whenever
some other part of the UI requested a discard.

This removes `w.visible` from `interested_in_focus`.
Invisible widgets are still hidden from accessibility, and their focus
is still not reported to AccessKit (the tree reports the root as focused
instead).

Added the regression test `keep_focus_in_discarded_pass`.

_This PR was written by Claude, an LLM, on behalf of @emilk._

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

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 12:47:26 +02:00
Emil ErnerfeldtandClaude Fable 5.1 a99dc715f1 Add Aligned container for aligning a custom Ui in parent (#8540)
* [x] I have followed the instructions in the PR template

Adds `egui::Aligned`, a container that places its contents at a given
`Align2` within the available space of the parent `Ui`, e.g. in the
bottom-right corner.

Since the size of the contents isn't known up front, it remembers the
size from the previous pass. On the first pass the contents are added
invisibly and a new pass is requested with `request_discard`, so there
is no flicker.

```rust
egui::Aligned::new(egui::Align2::RIGHT_BOTTOM).show(ui, |ui| {
    ui.label("Bottom right");
    let _ = ui.button("Click me");
});
```

Like a `Panel`, `Aligned` reserves space in the parent `Ui` along its
main axis: if the contents are aligned to the end of that axis (e.g. the
bottom of a vertical `Ui`), widgets added afterwards go in the space
*before* them. So you can put something in the bottom-right corner and
keep adding widgets above it:

```rust
egui::Aligned::new(egui::Align2::RIGHT_BOTTOM).show(ui, |ui| {
    let _ = ui.button("Bottom right");
});
ui.label("Placed above the button");
```

Rerun uses this to overlay the legend on a plot.

Extracted from Rerun's `re_ui::egui_ext` (where it is called `Group`).
Naming suggestions welcome.

Written by Claude (LLM).

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-24 12:47:05 +02:00