Introduce Window::try_dispatch_event (#7313)

That is the same as Window::dispatch_event, but it reports an error
instead of panicking
This commit is contained in:
Olivier Goffart 2025-01-09 19:39:38 +01:00 committed by GitHub
parent 19bfe926d2
commit cfbcf0b1d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 137 additions and 102 deletions

View file

@ -154,11 +154,11 @@ impl slint::platform::Platform for EspBackend {
let is_pointer_release_event =
matches!(event, WindowEvent::PointerReleased { .. });
window.dispatch_event(event);
window.try_dispatch_event(event)?;
// removes hover state on widgets
if is_pointer_release_event {
window.dispatch_event(WindowEvent::PointerExited);
window.try_dispatch_event(WindowEvent::PointerExited)?;
}
}
}