mirror of
https://code.gri.mw/GUI/grim.git
synced 2026-07-13 18:28:55 +00:00
ui: esc key handling for keyboard without modal
This commit is contained in:
+6
-3
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user