Skip to content

Commit 78e568a

Browse files
authored
Merge pull request #256 from LedgerHQ/y333/bagl_forward_button_event_to_os
2 parents b4acd75 + c561c4a commit 78e568a

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ledger_device_sdk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ledger_device_sdk"
3-
version = "1.22.2"
3+
version = "1.22.3"
44
authors = ["yhql", "yogh333", "agrojean-ledger", "kingofpayne"]
55
edition = "2021"
66
license.workspace = true

ledger_device_sdk/src/ui/gadgets.rs

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -538,33 +538,37 @@ impl<'a> MultiPageMenu<'a> {
538538

539539
loop {
540540
match self.comm.next_event() {
541-
io::Event::Button(button) => match button {
542-
BothButtonsRelease => return EventOrPageIndex::Index(index),
543-
b => {
544-
match b {
545-
LeftButtonRelease => {
546-
if index as i16 - 1 < 0 {
547-
index = self.pages.len() - 1;
548-
} else {
549-
index = index.saturating_sub(1);
550-
}
551-
}
552-
RightButtonRelease => {
553-
if index < self.pages.len() - 1 {
554-
index += 1;
555-
} else {
556-
index = 0;
541+
io::Event::Button(button) => {
542+
if UxEvent::Event.request() == BOLOS_UX_OK {
543+
match button {
544+
BothButtonsRelease => return EventOrPageIndex::Index(index),
545+
b => {
546+
match b {
547+
LeftButtonRelease => {
548+
if index as i16 - 1 < 0 {
549+
index = self.pages.len() - 1;
550+
} else {
551+
index = index.saturating_sub(1);
552+
}
553+
}
554+
RightButtonRelease => {
555+
if index < self.pages.len() - 1 {
556+
index += 1;
557+
} else {
558+
index = 0;
559+
}
560+
}
561+
_ => (),
557562
}
563+
clear_screen();
564+
self.pages[index].place();
565+
LEFT_ARROW.display();
566+
RIGHT_ARROW.display();
567+
crate::ui::screen_util::screen_update();
558568
}
559-
_ => (),
560569
}
561-
clear_screen();
562-
self.pages[index].place();
563-
LEFT_ARROW.display();
564-
RIGHT_ARROW.display();
565-
crate::ui::screen_util::screen_update();
566570
}
567-
},
571+
}
568572
io::Event::Command(ins) => return EventOrPageIndex::Event(io::Event::Command(ins)),
569573
io::Event::Ticker => {
570574
if UxEvent::Event.request() != BOLOS_UX_OK {

0 commit comments

Comments
 (0)