Commit Graph

4017 Commits

Author SHA1 Message Date
Lucas Meurer 9150b9342d
Make individual egui_extras image loaders public (#7551)
This was initially a PR to add kitdiff, but this now lives in it's own
crate: https://github.com/rerun-io/kitdiff

I needed to make the image loaders public, this way it's possible to
compose image loaders together (which allowed me to create a image diff
loader that uses two other image loaders). But you can't use the
`ctx.try_load_image` since that would deadlock, so you have to store a
reference to the other loader in the wrapping loader.
2025-09-23 10:07:18 +02:00
Kumpelinus c97c065a57
Update wgpu to 26 and wasm-bindgen to 0.2.100 (#7540)
Co-authored-by: TÖRÖK Attila <torokati44@gmail.com>
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-09-21 20:42:00 +02:00
Emil Ernerfeldt 6ac155c5cd
eframe web: prevent default action on command-comma (#7547) 2025-09-17 08:12:50 +02:00
Emil Ernerfeldt 603dba29e6
Add snapshot test for text spacing/kerning (#7545) 2025-09-16 13:30:28 +02:00
Lucas Meurer f2f00ef62a
New Plugin trait (#7385)
This adds a new `Plugin` trait and new `input_hook` and `output_hook`
plugin fns. Having a `Plugin` trait should make it easier to store state
in the plugin and improve discoverability of possible plugin hooks.

The old `on_begin_pass` and `on_end_pass` have been ported to use the
new plugin trait, should we deprecate them?
2025-09-16 10:55:58 +02:00
Emil Ernerfeldt 226bdc4c5b
0.32.3 release: Bump version numbers and update changelog (#7536) 2025-09-12 08:18:19 +02:00
Lucas Meurer 2d3ecd3494
Reset wrapping in label tooltip (#7535)
* follow up to #7514 

That PR changed the tooltip to preserve the wrapping, which made the
tooltip kind of useless. With this PR the wrapping is reset for the
tooltip.
2025-09-11 17:18:53 +02:00
Alan Everett b0c568a78e
Add rotation gesture support for trackpad sources (#7453)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2025-09-11 12:44:17 +02:00
Emil Ernerfeldt 802d307e4a
Remove deprecated fields from `PlatformOutput` (#7523) 2025-09-09 16:07:39 +02:00
Emil Ernerfeldt 72b9b9d750
Increase default text size from 12.5 to 13.0 (#7521) 2025-09-09 15:47:24 +02:00
Sven Niederberger ec5bc35c38
Add an option to limit the repaint rate in the web runner (#7482)
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-09-09 13:49:35 +02:00
Zakarum 9db03983dd
Fix `TextEdit`'s in RTL layouts (#5547)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-09-09 13:45:44 +02:00
Lucas Meurer ea76b4eeca
Add `egui_kittest::HarnessBuilder::with_os` and set the default to `Nix` (#7493)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-09-09 13:44:59 +02:00
Pēteris Pakalns 2afc43c0ec
Support on hover tooltip that is noninteractable even with interactable content (#5543) 2025-09-09 11:21:54 +02:00
Nicolas 75b50c90e8
Remove deprecated `Harness::wgpu_snapshot` and related fns (#7504) 2025-09-09 11:18:00 +02:00
Nicolas 835e4f17df
feat: Add serde serialization to SyntectSettings (#7506) 2025-09-09 11:17:07 +02:00
Emil Ernerfeldt c2912369ca
Improve text demo: more fine control of letter spacing (#7520) 2025-09-09 09:35:25 +02:00
Emil Ernerfeldt 01ee23c1a0
Add Zoom Factor to options panel (#7517) 2025-09-08 18:27:28 +02:00
Emil Ernerfeldt b822977e7f
Remove `preload_font_glyphs` flag (#7516) 2025-09-08 18:17:55 +02:00
valadaptive 742b1dc920
Optimize `Mesh::add_rect_with_uv` (#7511) 2025-09-08 17:40:45 +02:00
valadaptive a8e36e3313
Improve `OrderedFloat` hash performance (#7512)
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2025-09-08 17:39:52 +02:00
Emil Ernerfeldt 9cc7f2ec16
Improve deadlock detection output (#7515) 2025-09-08 17:37:49 +02:00
valadaptive d5b0a6f446
More even text kerning (#7431)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-09-08 17:29:41 +02:00
Lucas Meurer e5d0b93633
Preserve text format in truncated label tooltip (#7514)
* Related https://github.com/rerun-io/rerun/issues/10906

This changes the label hover ui to use the provided layout job instead
of the text so that the text format is preserved.
2025-09-08 15:41:05 +02:00
Lucas Meurer 34cd613378
Update changelogs and versions for 0.32.2 (#7505) 2025-09-08 10:42:10 +02:00
Lucas Meurer 73c5892a4d
Generate changelogs for emath (#7513)
Sometimes there are changes that only affect emath, so those should be
listed somewhere
2025-09-08 10:13:21 +02:00
Emil Ernerfeldt aedd43c88f
kittest: Add `UPDATE_SNAPSHOTS=force` (#7508)
This adds a new mode, `UPDATE_SNAPSHOTS=force`, which will lower the
threshold to zero, overwriting every image that is not _exactly_ the
same.

Most comparisons has a threshold because different GPUs render slightly
differently. However, setting that threshold accurately can be hard.

Sometimes a test will pass locally, but fail on CI. In those cases you
want to force an update of the failing test. You can use
`UPDATE_SNAPSHOTS=force` for that.

And sometimes a small change _should_ update all images, but the change
is so tiny that it falls under the threshold. Still, you want to make a
point of showing that these images have changes. You can use
`UPDATE_SNAPSHOTS=force` for that.
2025-09-05 16:45:36 +02:00
Emil Ernerfeldt eceb0b11c9
Document how to push git lfs files to 3rd party PRs (#7507) 2025-09-05 10:47:23 +02:00
Stelios Kourlis 5fd452310b
Deprecated `ImageButton` and removed `WidgetType::ImageButton` (#7483)
<!--
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/7466>
* [x] I have followed the instructions in the PR template
* I have ran `./scripts/check.sh` and it has no fails
* I have run `cargo fmt` and `cargo clippy`

Added the deprecated tag to ImageButton struct
Removed the `WidgetType::ImageButton` variant. ImageButton will use
`WidgetType::Button` for its WidgetInfo

*This is my first PR ever, please let me know if I did something wrong
so I can change it*

---------

Co-authored-by: Nicolas <bircni@icloud.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2025-09-04 15:03:10 +02:00
YgorSouza 669cdc1fff
Remove line breaks when pasting into single line TextEdit (#7441)
The line breaks are now replaced by spaces, matching the usual behavior
of text fields in HTML.

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

Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2025-09-04 13:53:02 +02:00
Andrew Farkas 1c460b6dc0
Skip zero-length layout job sections (#7430)
Fixes #7378 

Includes a regression test that previously failed and now succeeds.

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

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2025-09-04 13:17:59 +02:00
Aleksandr Strizhevskiy 763e2df9f9
Fix: prevent calendar popup from closing on dropdown change (#7409)
Currently, DatePickerButton will close without saving whenever a user
clicks a dropdown from year/month/date. The issue is caused because the
system mistakenly interprets the user as clicking off of the calendar.
This is unexpected and creates an unpleasant experience for the user.
This change now allows the user to use the dropdowns as expected; it
will close on save or cancel. The calendar still closes when user clicks
off of it, as before. The changes here are made in:
crates/egui_extras/src/datepicker/button.rs

I will admit that I am not an experienced Rust developer. The changes
were made with the help of ChatGPT 4.0.
I have tested the changes locally, as I am using the date picker in my
project.


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

---------

Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2025-09-04 13:13:28 +02:00
darkwater 3a2094e80e
Add `Memory::move_focus` (#7476)
<!--
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

This allows us to programatically move focus around. Another way would
be to inject arrow key inputs, but that requires the backend to
implement a way to do that, and could have unintended side-effects.

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-09-04 13:02:18 +02:00
Lucas Meurer 80d61a7c53
Remove the `deadlock_detection` feature (#7497)
* related #7494 

Removes the `deadlock_detection` feature, since we now have a more
primitive panic-after-30s deadlock detection which works well enough and
even detects kinds of deadlocks that the `deadlock_detection` feature
never supported.
2025-09-04 12:57:09 +02:00
Lucas Meurer d66fa63e20
Add reasonable timeouts to all workflows (#7499)
Turns out the default timeout for github actions is 6 hours (!). This PR
sets some reasonable default for all workflows, the ones invoking cargo
in some way are limited to 60 minutes and the remaining ones to
10-15mins.
2025-09-04 12:37:24 +02:00
Lucas Meurer fa4bee3bf7
Fix deadlock in `ImageLoader`, `FileLoader`, `EhttpLoader` (#7494)
* Recently CI runs started to hang randomly:
https://github.com/emilk/egui/actions/runs/17427449210/job/49477714447?pr=7359

This fixes the deadlock and adds the basic deadlock detection we also
added to Mutexes in #7468.

Also, interestingly, the more sophisticated deadlock detection (behind
the deadlock_detection feature) didn't catch this for some reason. I
wonder why it exists in the first place, when parking_lot also has built
in deadlock detection? It also seems to make tests slower, widget_tests
usually needs ~30s, with the deadlock detection removed its only ~12s.
2025-09-04 10:31:26 +02:00
Lucas Meurer d3cd6d44cf
Add `Ui::place`, to place widgets without changing the cursor (#7359)
* Closes <https://github.com/emilk/egui/issues/7353>

Currently `ui.put` moves the cursor after the placed widget. In my
opinion that is a bit unexpected and counterproductive in most cases
where `ui.put` makes sense.

The following example breakes with the current behavior and looks right
with my change:
```rs
            ui.horizontal(|ui| {
                let custom_button_id = Id::new("custom_button");
                let response = Button::new((
                    Atom::custom(custom_button_id, Vec2::splat(18.0)),
                    "Look at my mini button!",
                ))
                .atom_ui(ui);
                if let Some(rect) = response.rect(custom_button_id) {
                    ui.put(rect, Button::new("🔎").frame_when_inactive(false));
                }

                let custom_button_id = Id::new("custom_button");
                let response = Button::new((
                    Atom::custom(custom_button_id, Vec2::splat(18.0)),
                    "Look at my mini button!",
                ))
                .atom_ui(ui);
                if let Some(rect) = response.rect(custom_button_id) {
                    ui.put(rect, Button::new("🔎").frame_when_inactive(false));
                }
            });

            ui.add_space(10.0);

            let response = ui.button("Notifications");

            ui.put(
                Rect::from_center_size(response.rect.right_top(), Vec2::splat(12.0)),
                |ui: &mut Ui| {
                    Frame::new()
                        .fill(Color32::RED)
                        .corner_radius(10.0)
                        .show(ui, |ui| {
                            ui.label(RichText::new("11").size(8.0).color(Color32::WHITE));
                        }).response
                },
            );

            ui.button("Some other button");
```

<img width="253" height="86" alt="Screenshot 2025-07-14 at 10 58 30"
src="https://github.com/user-attachments/assets/fca56e60-e3c0-4b59-8e2d-0a39aefea9f9"
/>


<img width="361" height="107" alt="Screenshot 2025-07-14 at 10 58 51"
src="https://github.com/user-attachments/assets/85e2fbf9-9174-41e0-adaa-60c721b16bf6"
/>

I had a look at reruns source code and there are no uses of `ui.put`
that would break with this change (very little usages in general).

## Alternatives
Instead of a breaking change we could of course instead introduce a new
metheod (e.g. `Ui::place`?).
2025-09-04 10:07:35 +02:00
Emil Ernerfeldt 4947b191e4
Make more dependencies workspace dependencies (#7495) 2025-09-04 09:54:59 +02:00
Oscar Gustafsson b9414bd4cc
Selectively update dependencies to reduce total number (#7488)
<!--
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

Update some of the core dependencies and run cargo update for selected
dependencies to remove total number and older versions.
2025-09-04 09:42:46 +02:00
Dot32 01ee9c72d5
Fix typo in the description of the `id` method in `ui.rs` (#7457)
<!--
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 description of the id method in the Ui struct incorrectly wrote
"where" instead of "were".

<img width="668" height="201" alt="Screenshot 2025-08-15 at 7 03 27 pm"
src="https://github.com/user-attachments/assets/df35cdab-b3ad-44d4-a565-cd9a4d883f21"
/>

This PR fixes that typo.
2025-09-04 09:18:53 +02:00
Lucas Meurer ab8dcee7e7
Fix egui_demo_app missing wgpu backends (#7492)
* This was broken in https://github.com/emilk/egui/pull/7344
2025-09-03 12:55:02 +02:00
n4n5 0a81372cfd
Add theme selection for code editor (#7375)
Change the theme selection of the code editor

Before
- was showing the window theme selector

After
- is showing the code editor theme selector


<img width="327" height="262" alt="image"
src="https://github.com/user-attachments/assets/50776218-26cc-4f11-9b91-6f902c022394"
/>


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

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-08-24 16:41:10 +02:00
Sergey Ukolov 2957fd56a5
Fix: use unique id for resize columns in `Table` (#7414)
Currently the IDs for resize columns in Table are based on the ID of
parent. When placing multiple tables within the same parent the ID clash
for resize columns occurs despite the
[TableBuilder::id_salt](https://docs.rs/egui_extras/0.32.0/egui_extras/struct.TableBuilder.html#method.id_salt)
is being used.
2025-08-24 16:40:44 +02:00
Emil Ernerfeldt 0fad7d8503
Enable more clippy lints (#7474) 2025-08-24 16:27:28 +02:00
Emil Ernerfeldt 608de4a264
Update bytemuck (#7475) 2025-08-24 16:27:21 +02:00
Emil Ernerfeldt a5a51ced0f Improve egui-winit profile scope 2025-08-24 15:03:57 +02:00
ozwaldorf 454af7aa6c
fix: `SubMenu` should not display when ui is disabled (#7428)
<!--
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!
-->

Adds a check for `ui.is_enabled()` when displaying the SubMenu items.
There were a few places the condition could be placed, but I figured
there was simplest. The inner button will already not be able to be
clicked due to ui being disabled.

cc @lucasmerlin 

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

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-08-24 14:43:31 +02:00
Lucas Meurer 42c2fc58c9
Allow masking widgets in kittest snapshots (#7467)
* Closes <https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE>
* [ ] I have followed the instructions in the PR template
2025-08-21 17:46:36 +02:00
Lucas Meurer bf981b8d3e
Add `SurrenderFocusOn` option (#7471)
* [X] I have followed the instructions in the PR template

On touch devices you don't want the keyboard to disappear when
scrolling, so this PR adds a `SurrenderFocusOn` enum to configure on
what interaction to surrender focus.
2025-08-21 17:45:34 +02:00
Emil Ernerfeldt 5453cceded
Use official cargo machete action (#7470) 2025-08-21 15:42:10 +02:00