A couple of fixes

This commit is contained in:
jpirnay
2026-05-11 23:02:27 +02:00
parent 5b3f1ad200
commit 4982f803a7
7 changed files with 35 additions and 23 deletions
+15 -12
View File
@@ -113,18 +113,21 @@ inline PageTurnResult detectPageTurn(const MappedInputManager& input) {
if (tiltNegative) {
applyTiltAction(SETTINGS.tiltNegativeAction);
}
const bool prev = tiltPrev || ((SETTINGS.btnShortPageBack == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageBack) &&
input.wasReleased(MappedInputManager::Button::PageBack)) ||
(SETTINGS.btnShortLeft == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Left) &&
input.wasReleased(MappedInputManager::Button::Left)));
const bool next = tiltNext || ((SETTINGS.btnShortPageForward == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageForward) &&
input.wasReleased(MappedInputManager::Button::PageForward)) ||
(SETTINGS.btnShortRight == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Right) &&
input.wasReleased(MappedInputManager::Button::Right)));
const bool prevButtonReleased = (SETTINGS.btnShortPageBack == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageBack) &&
input.wasReleased(MappedInputManager::Button::PageBack)) ||
(SETTINGS.btnShortLeft == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Left) &&
input.wasReleased(MappedInputManager::Button::Left));
const bool nextButtonReleased = (SETTINGS.btnShortPageForward == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageForward) &&
input.wasReleased(MappedInputManager::Button::PageForward)) ||
(SETTINGS.btnShortRight == BA::BTN_DEFAULT &&
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Right) &&
input.wasReleased(MappedInputManager::Button::Right));
const bool prev = tiltPrev || prevButtonReleased;
const bool next = tiltNext || nextButtonReleased;
return {prev, next};
}
+7 -1
View File
@@ -140,7 +140,13 @@ void TxtReaderActivity::onExit() {
}
void TxtReaderActivity::loop() {
if (inputDrainGuard.shouldDrain(mappedInput)) {
const bool drainActive = inputDrainGuard.shouldDrain(mappedInput);
if (!drainActive && drainWasActive) {
halTiltSensor.clearPendingEvents();
}
drainWasActive = drainActive;
if (drainActive) {
buttonEvents.drain();
return;
}
@@ -16,6 +16,7 @@ class TxtReaderActivity final : public Activity {
int totalPages = 1;
int pagesUntilFullRefresh = 0;
ReaderUtils::InputDrainGuard inputDrainGuard;
bool drainWasActive = false;
// Bookmarks (starred pages)
BookmarkStore bookmarkStore;