Fix button race

This commit is contained in:
jpirnay
2026-05-02 23:38:19 +02:00
parent 62a3ab0d66
commit 8cebf6e319
3 changed files with 21 additions and 12 deletions
@@ -164,19 +164,22 @@ void OpdsBookBrowserActivity::loop() {
}
if (!entries.empty()) {
buttonNavigator.onNextRelease([this] {
// Navigator is restricted to Up/Down so a Left release used to launch
// search (line above) cannot also be consumed here as a previous-item
// step on the same tick.
buttonNavigator.onRelease({MappedInputManager::Button::Down}, [this] {
selectorIndex = ButtonNavigator::nextIndex(selectorIndex, entries.size());
requestUpdate();
});
buttonNavigator.onPreviousRelease([this] {
buttonNavigator.onRelease({MappedInputManager::Button::Up}, [this] {
selectorIndex = ButtonNavigator::previousIndex(selectorIndex, entries.size());
requestUpdate();
});
buttonNavigator.onNextContinuous([this] {
buttonNavigator.onContinuous({MappedInputManager::Button::Down}, [this] {
selectorIndex = ButtonNavigator::nextPageIndex(selectorIndex, entries.size(), PAGE_ITEMS);
requestUpdate();
});
buttonNavigator.onPreviousContinuous([this] {
buttonNavigator.onContinuous({MappedInputManager::Button::Up}, [this] {
selectorIndex = ButtonNavigator::previousPageIndex(selectorIndex, entries.size(), PAGE_ITEMS);
requestUpdate();
});