ui: esc key handling for keyboard without modal

This commit is contained in:
ardocrat
2025-05-28 11:11:22 +03:00
parent 4d4b5eb007
commit b7563e63c1
2 changed files with 8 additions and 7 deletions
+6 -3
View File
@@ -75,11 +75,14 @@ impl<Platform: PlatformCallbacks> App<Platform> {
self.first_draw = false;
}
// Handle Esc keyboard key event and platform Back button key event.
// Handle Esc keyboard key event.
let back_pressed = BACK_BUTTON_PRESSED.load(Ordering::Relaxed);
if back_pressed || ctx.input_mut(|i| i.consume_key(Modifiers::NONE, egui::Key::Escape)) {
// Pass event to content.
self.content.on_back(&self.platform);
if Modal::on_back() {
self.content.on_back(&self.platform);
} else if KeyboardContent::window_showing() {
KeyboardContent::hide();
}
if back_pressed {
BACK_BUTTON_PRESSED.store(false, Ordering::Relaxed);
}
+2 -4
View File
@@ -239,10 +239,8 @@ impl Content {
/// Handle Back key event.
pub fn on_back(&mut self, cb: &dyn PlatformCallbacks) {
if Modal::on_back() {
if self.wallets.on_back(cb) {
Self::show_exit_modal()
}
if self.wallets.on_back(cb) {
Self::show_exit_modal()
}
}