From f7099c88adcba532c16d65734f412544c2a857ee Mon Sep 17 00:00:00 2001 From: Henrique Morato Date: Mon, 25 May 2026 12:26:27 -0300 Subject: [PATCH] fix: Unpin button in Sleep Image Picker now actually unpins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - List mode binds Up/Down explicitly via onPressAndContinuous so Left is no longer consumed by ButtonNavigator's "previous" action - Was a button-down vs button-up race: onPrevious (Up+Left, button-down) moved the cursor before wasReleased(Left) read selectorIndex, so Unpin pinned the row above instead of clearing the pin - Slideshow mode untouched — Left = previous image remains correct --- src/activities/tools/SleepImagePickerActivity.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/activities/tools/SleepImagePickerActivity.cpp b/src/activities/tools/SleepImagePickerActivity.cpp index d163750e08..2d4b925073 100644 --- a/src/activities/tools/SleepImagePickerActivity.cpp +++ b/src/activities/tools/SleepImagePickerActivity.cpp @@ -314,8 +314,13 @@ void SleepImagePickerActivity::loop() { } const int items = totalItems(); - buttonNavigator.onNext([this, items] { selectorIndex = ButtonNavigator::nextIndex(selectorIndex, items); requestUpdate(); }); - buttonNavigator.onPrevious([this, items] { selectorIndex = ButtonNavigator::previousIndex(selectorIndex, items); requestUpdate(); }); + // Bind Up/Down explicitly (not via onNext/onPrevious) so Left/Right stay free + // for the Pin/Unpin handler below — otherwise Left's button-down would move + // the cursor before wasReleased(Left) reads selectorIndex. + buttonNavigator.onPressAndContinuous({MappedInputManager::Button::Down}, + [this, items] { selectorIndex = ButtonNavigator::nextIndex(selectorIndex, items); requestUpdate(); }); + buttonNavigator.onPressAndContinuous({MappedInputManager::Button::Up}, + [this, items] { selectorIndex = ButtonNavigator::previousIndex(selectorIndex, items); requestUpdate(); }); if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) { if (selectorIndex == MODE_ITEM) {