1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00
Commit Graph

4120 Commits

Author SHA1 Message Date
adrien
58992a635a rename style_trait.rs -> widget_style.rs and font/color fallback for button 2025-11-19 09:26:28 +01:00
adrien
0b9f70d47b remove unused import 2025-11-12 18:18:20 +01:00
adrien
2f917bcb9f fix text color override 2025-11-12 17:29:29 +01:00
adrien
34bf318782 fix features 2025-11-12 10:05:30 +01:00
adrien
c3ce6bf11f cleanup snapshot 2025-11-10 19:26:56 +01:00
adrien
a17aa67267 cleanup 2025-11-10 17:39:33 +01:00
adrien
db4c159061 Merge branch 'widget_style' of github.com:AdrienZianne/egui into widget_style 2025-11-10 17:36:03 +01:00
AdrienZ.
ec558b8ce7 Merge branch 'main' into widget_style 2025-11-10 17:32:16 +01:00
adrien
4bd97cec58 revert gitignore 2025-11-10 17:28:34 +01:00
adrien
e1af88748b more pixel diff fix 2025-11-10 17:12:57 +01:00
Emil Ernerfeldt
93425ae06b Allow multiple atoms in Button::shortcut_text and right_text (#7696)
Useful when intermixing text and icons (e.g. for modifiers)
2025-11-10 16:34:58 +01:00
adrien
abeb7a2a9c Merge branch 'widget_style' of github.com:AdrienZianne/egui into widget_style 2025-11-10 10:16:35 +01:00
adrien
33db68f1ba Fix pixel diff 2025-11-10 10:16:20 +01:00
Adrien Zianne
94f8ad6099 fix check 2025-11-07 17:24:16 +01:00
Emil Ernerfeldt
fa4cfec777 Change text color of selected text (#7691)
Selected text now gets the color of `visuals.selection.stroke.color`.
This means you can have inverted colors for selected text, like in the
new test:
<img width="154" height="46" alt="image"
src="https://github.com/user-attachments/assets/2666361d-d7e2-4d50-8e4d-2fcc128f1a81"
/>


It also means the color of selected text in labels matches that of the
text color of selected buttons.
2025-11-07 15:34:36 +01:00
adrien
a74851597a fix snapshot 2025-11-07 14:54:07 +01:00
adrien
b938a27ca9 temp 2025-11-07 14:51:01 +01:00
Emil Ernerfeldt
d8dcb31673 kittest: add drag-and-drop helpers (#7690) 2025-11-07 14:46:09 +01:00
Emil Ernerfeldt
1d4d14f18e Hide scroll bars when dragging other things (#7689)
This closes a small visual glitch where scroll bars would show up when
dragging something unrelated, like a slider or a panel side.
2025-11-07 14:43:49 +01:00
Lucas Meurer
04913ed651 Add some more text edit tests (#7608)
Adds tests to text the clip option in text edits and how it behaves with
a placeholder

---------

Co-authored-by: lucasmerlin <8009393+lucasmerlin@users.noreply.github.com>
2025-11-07 13:34:25 +01:00
Lucas Meurer
1e63bfd657 Improve accessibility and testability of ComboBox (#7658)
Changed it to use labeled_by to avoid kittest finding the label when
searching for the ComboBox and also set the value so a screen reader
will know what's selected.
2025-11-07 13:34:18 +01:00
adrien
daccad61cd check passed 2025-11-07 11:34:19 +01:00
Adrien Zianne
2df6154d9d Button resize fix + Margin i8 -> i16 2025-11-07 11:34:19 +01:00
Adrien Zianne
509d17d539 checkbox & cleanup 2025-11-07 11:34:19 +01:00
Adrien Zianne
785e19f999 CheckboxStyle 2025-11-07 11:34:19 +01:00
Adrien Zianne
a40959b047 Finish label 2025-11-07 11:34:18 +01:00
Adrien Zianne
5265d4ef0c apply style to label 2025-11-07 11:34:18 +01:00
Adrien Zianne
ce5c9cdd52 fix some logic 2025-11-07 11:34:18 +01:00
adrien
c2e62f87d7 Finish button : retrocompatibility + comments 2025-11-07 11:34:18 +01:00
adrien
e99ce8dec7 style by widget 2025-11-07 11:34:18 +01:00
adrien
f97ade3d7b check passed 2025-11-07 11:11:07 +01:00
Emil Ernerfeldt
31d313572b Make sure native_pixels_per_point is set during app creation (#7683)
Useful for things like analytics
2025-11-05 10:35:57 +01:00
Emil Ernerfeldt
706ce10abd Fix edge cases in "smart aiming" in sliders (#7680)
When dragging slider, we try to pick nice, round values. There were a
couple edge cases there that were handled wrong. This is now fixed.
2025-11-03 18:56:18 +01:00
Emil Ernerfeldt
1b77d7047e Improve modifier handling when scrolling (#7678)
### Problem
Letting go of the modifier key before the last momentum-scroll events
arrive will cause the scroll direction to change. This problem can be
seen by going to egui.rs and opening the "Scene" example. Hold down
shift, start a momentum-scroll (on a Mac trackpad), then quickly let go
of shift: you'll see the scroll direction change, which feels wrong.

### Solution
Store the modifiers at the start of the event, thanks to the new `phase`
info added in
* https://github.com/emilk/egui/pull/7669

Note that this solution only works on native; not on web.

### Other
* Break out wheel/scroll handling into own file
* Simplify it a lot by deciding late on wether an input is a scroll or a
zoom
* Assume input is already smooth if there are `phase` events
2025-11-03 11:53:55 +01:00
Pēteris Pakalns
fa3457f21c Fix profiling::scope compile error when profiling using tracing backend (#7646)
* Closes https://github.com/emilk/egui/issues/7645
* [x] I have followed the instructions in the PR template
2025-11-02 11:28:33 +01:00
ASPCartman
c5347f28e4 Fix jittering during window resize on MacOS for WGPU/Metal (#7641)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-11-01 12:55:56 +01:00
Hubert Głuchowski
e861c8ec79 Avoid cloning Rows during Galley::concat (#7649)
<!--
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!
-->

Moves `ends_with_newline` into `PlacedRow` to avoid clones during
layout.
I don't think there was a rationale stronger than "don't change too
much" for not doing this in https://github.com/emilk/egui/pull/5411, so
I should've just done this from the start.
This was a significant part of the profile for text layout (as it cloned
almost every `Row`, even though it only needed to change a single
boolean).

Before:
<img width="757" height="250" alt="image"
src="https://github.com/user-attachments/assets/d1c2afd1-f1ec-4cf5-9d05-f5a5a78052df"
/>

After:
<img width="615" height="249" alt="image"
src="https://github.com/user-attachments/assets/c70966da-c892-4e84-adba-494d0f37f263"
/>

(note that these profiles focus solely on the top-level
`Galley::layout_inline` subtree, also don't compare sample count as the
duration of these tests was completely arbitrary)

egui_demo_lib `*text_layout*` benches:
<img width="791" height="461" alt="image"
src="https://github.com/user-attachments/assets/4f97ce84-2768-4876-9488-d42f8f358ed1"
/>

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

(As usual, the tests fail for me even on master but the failures on
master and with these changes seem the same :))
2025-10-31 10:45:32 +01:00
Juan Campa
2669344d5c Add Plugin::on_widget_under_pointer to support widget inspector (#7652)
This PR adds `Plugin::on_widget_under_pointer` which gets called
whenever a widget is created whose rect contains the pointer.

The point of the hook is to capture a stack trace which can be used to
map widgets to their corresponding source code so it must be called
while the widget is being created. The obvious concern is performance
impact. However, since it's only called for rects under the cursor, the
effect seems negligible afaict. It's under `debug_assertions` just in
case.

This change is needed so we can publish the widget inspector we've been
working on. Basically a plugin that allows us to jump from any widget
back to their corresponding source code.

This video shows the plugin configured to open the corresponding code in
github, but normally it would open your local editor.

Update: [Live demo](https://membrane-io.github.io/egui/) (Firefox/Safari
not yet supported. `Cmd-I` to inspect. `Tab` to cycle filters. `Click`
to open). It will try to open a file under
`/home/runner/work/egui/egui/` so it won't work, but you get the idea.


https://github.com/user-attachments/assets/afe4d6af-7f67-44b5-be25-44f7564d9a3a

## What's next

After this gets merged I plan to publish the above plugin as its own
crate, that way we can iterate and release quickly while things are
still changing. I agree it would make sense to eventually merge it into
the main egui repo (like @emilk suggested in #4650).

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

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-10-27 14:52:42 +01:00
Isse
999e943e59 Add is_scrolling/is_smooth_scrolling util, checking for active scroll action. (#7669)
* Closes #7657
* [x] I have followed the instructions in the PR template

On native this uses a new "touch phase" parameter of the mouse wheel
event to know if a scroll action is done.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-10-27 11:46:51 +01:00
Ian Hobson
f6fa74c665 Don't enable arboard on iOS (#7663)
`arboard` [doesn't support support iOS
yet](https://github.com/1Password/arboard/pull/103), so this PR adds iOS
to the conditions that prevent `arboard` from being enabled.

Launching an app on a physical device results in a long timeout (~8s)
while trying to connect to the X11 server (the timeout is immediate when
launching on a simulator), with the following trace:

```
egui_winit:📋 Failed to initialize arboard clipboard: Unknown error while interacting with the clipboard: X11 server connection timed out because it was unreachable
```

<!--
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
2025-10-23 10:24:06 +02:00
Lucas Meurer
30eb38ef45 Fix kitdiff links in pr comments (#7639)
The pr data is not accessible in this workflow so I have to hardcode the
url with the pr number
2025-10-23 10:06:37 +02:00
Adrien Zianne
51c6c42f0e Button resize fix + Margin i8 -> i16 2025-10-21 11:06:39 +02:00
Adrien Zianne
b18070caef checkbox & cleanup 2025-10-21 10:42:42 +02:00
Adrien Zianne
1e346da874 CheckboxStyle 2025-10-16 17:11:51 +02:00
Adrien Zianne
e39d8c4345 Finish label 2025-10-16 13:22:09 +02:00
Adrien Zianne
f66b5b599b apply style to label 2025-10-15 17:44:29 +02:00
Adrien Zianne
ad4b0de2b3 fix some logic 2025-10-15 15:35:03 +02:00
Emil Ernerfeldt
bf5604b3c7 Release egui_kittest 0.33.1 2025-10-15 12:13:52 +02:00
Emil Ernerfeldt
c79096ecc4 Add egui_kittest::Harness::set_options (#7638)
Makes it easier to set the same options for many tests

---------

Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
2025-10-15 11:42:52 +02:00
adrien
a99adc6c93 Finish button : retrocompatibility + comments 2025-10-13 21:46:50 +02:00