From cea0189dfd50c7b4e4641a7f7ff828ae714fee05 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Fri, 9 Jun 2023 23:21:13 +0200 Subject: [PATCH] TEST: button --- .../rust/src/ui/model_tt/component/homescreen/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs b/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs index 88d3ca3ac1..1dbabb5b99 100644 --- a/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs +++ b/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs @@ -27,6 +27,7 @@ use render::{ homescreen, homescreen_blurred, HomescreenNotification, HomescreenText, HOMESCREEN_IMAGE_HEIGHT, HOMESCREEN_IMAGE_WIDTH, }; +use crate::ui::event::{ButtonEvent, PhysicalButton}; use super::{theme, Loader, LoaderMsg}; @@ -181,10 +182,17 @@ where fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option { Self::event_usb(self, ctx, event); if self.hold_to_lock { - Self::event_hold(self, ctx, event).then_some(HomescreenMsg::Dismissed) + if Self::event_hold(self, ctx, event) { + return Some(HomescreenMsg::Dismissed) + } + } + + if let Event::Button(ButtonEvent::ButtonPressed(PhysicalButton::Power)) = event { + Some(HomescreenMsg::Dismissed) } else { None } + } fn paint(&mut self) {