mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 12:50:04 -04:00
<!-- 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.