1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 22:30:03 -04:00

Pass accesskit tree to after_step, drop on_accesskit_update

Replaces the separate on_accesskit_update hook with a `&TreeUpdate`
parameter on `after_step` — one hook per step, tree delivered inline.
`step_no_side_effects` now returns the TreeUpdate so plugins driving
the harness from within their own hook (where nested dispatches are
suppressed) can still see it.

Also adds `#[track_caller]` to the internal `_step` / `_step_no_side_effects`
/ `_try_run` so `Location::caller()` inside `step()` walks up to the
user's original call site when reached via `run()`.
This commit is contained in:
lucasmerlin
2026-04-24 14:22:06 +02:00
parent c6490fcaf7
commit c71e6e2c6a
3 changed files with 30 additions and 21 deletions

View File

@@ -41,7 +41,11 @@ impl<S> Plugin<S> for CountingPlugin {
fn before_step(&mut self, _h: &mut Harness<'_, S>) {
self.push("before_step");
}
fn after_step(&mut self, _h: &mut Harness<'_, S>) {
fn after_step(
&mut self,
_h: &mut Harness<'_, S>,
_tree: &egui::accesskit::TreeUpdate,
) {
self.push("after_step");
}
fn on_event(&mut self, _h: &mut Harness<'_, S>, _event: &egui::Event) {
@@ -127,7 +131,7 @@ fn step_no_side_effects_skips_hooks() {
drove: bool,
}
impl<S: 'static> Plugin<S> for DrivingPlugin {
fn after_step(&mut self, h: &mut Harness<'_, S>) {
fn after_step(&mut self, h: &mut Harness<'_, S>, _tree: &egui::accesskit::TreeUpdate) {
self.log.lock().unwrap().push("after_step".into());
if !self.drove {
self.drove = true;
@@ -164,7 +168,7 @@ fn mid_dispatch_registration_is_deferred() {
registered: bool,
}
impl<S: 'static> Plugin<S> for Registrar {
fn after_step(&mut self, h: &mut Harness<'_, S>) {
fn after_step(&mut self, h: &mut Harness<'_, S>, _tree: &egui::accesskit::TreeUpdate) {
self.log.lock().unwrap().push("registrar:after_step".into());
if !self.registered {
self.registered = true;