egui/crates
Pol Welter 35860418ac
Use bitfield instead of bools in `Response` and `Sense` (#5556)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/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/3862>.

Factoring the `bool` members of `Response` into a bitfield, the size of
`Response` is now 96 bytes (down from 104).

I gave `Sense` the same treatment, however this has no effects on
`Response` due to padding. I've decided not to pursue `PointerState`, as
it is quite large (_many_ members that are sized and aligned to
multiples of 8 bytes), so I don't expect any noticeable benefit from
making handful of `bool`s slightly leaner.

In any case, the changes to `Sense` are already quite a bit more
intrusive than those to `Response`.
The previous implementation overloaded the names of the attributes
`click` and `drag` with similarly named methods that _construct_ `Sense`
with the corresponding flag set. Now, that the attributes can no longer
be accessed directly, I had to introduce methods with new names
(`senses_click()`, `senses_drag()` and `is_focusable()`). I don't think
this is the cleanest solution: the old methods are essentially redundant
now that the named constants like `Sense::CLICK` exist. I did however
not want to needlessly break backwards compatibility.
I am happy to revert it (or go further 🙂) if there are concerns.
2025-01-06 19:29:53 +01:00
..
ecolor Release 0.30 - egui_kittest and modals (#5487) 2024-12-16 17:45:35 +01:00
eframe Add `Harness::new_eframe` and `TestRenderer` trait (#5539) 2025-01-02 17:48:39 +01:00
egui Use bitfield instead of bools in `Response` and `Sense` (#5556) 2025-01-06 19:29:53 +01:00
egui-wgpu Add `Harness::new_eframe` and `TestRenderer` trait (#5539) 2025-01-02 17:48:39 +01:00
egui-winit Serialize window maximized state in `WindowSettings` (#5554) 2025-01-06 09:19:17 +01:00
egui_demo_app ⚠️ `Frame` now includes stroke width as part of padding (#5575) 2025-01-04 10:29:22 +01:00
egui_demo_lib ⚠️ `Frame` now includes stroke width as part of padding (#5575) 2025-01-04 10:29:22 +01:00
egui_extras Avoid allocations for loader cache lookup (#5584) 2025-01-06 10:03:33 +01:00
egui_glow Revert "Revert "forward x11 and wayland features to glutin" (#5391)" (#5490) 2024-12-17 09:36:03 +01:00
egui_kittest ⚠️ `Frame` now includes stroke width as part of padding (#5575) 2025-01-04 10:29:22 +01:00
egui_plot Move `egui_plot` to its own repo (#4828) 2024-07-15 18:45:19 +02:00
egui_web Fix typos (#2866) 2023-04-18 15:52:45 +02:00
emath Make all lines and rectangles crisp (#5518) 2024-12-26 21:02:27 +01:00
epaint Better rounding of rectangles with thin outlines (#5571) 2025-01-02 23:50:40 +01:00
epaint_default_fonts Release 0.30 - egui_kittest and modals (#5487) 2024-12-16 17:45:35 +01:00