From 23201fa637d4f2725074f6c0a77b0752f5db30f3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 8 Nov 2026 18:54:57 +0100 Subject: [PATCH] The confirmation of a transfer decision shows OK pressed while held Co-Authored-By: Claude Sonnet 5.5 --- src/app/main.cpp | 12 +++++++++--- src/ui/incoming_transfer.cpp | 13 ++++++++++++- src/ui/incoming_transfer.hpp | 3 +++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index b41ebd6..1ef9c26 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -2551,12 +2551,18 @@ int main(int argc, char** argv) { while (quit_confirmation.poll(&event)) { if (event.type == SDL_QUIT) { running = false; return; } if (event.type == SDL_MOUSEBUTTONDOWN && - (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) + (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) { decision_screen.pointer_down(event.button.button == SDL_BUTTON_RIGHT); - else if (event.type == SDL_MOUSEBUTTONUP && - (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) + // OK of the confirmation looks pressed while the mouse button is held + if (event.button.button == SDL_BUTTON_LEFT && confirmation && + decision_screen.press(event.button.x, event.button.y)) + rendered_phase = UINT64_MAX; + } else if (event.type == SDL_MOUSEBUTTONUP && + (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) { (void)decision_screen.pointer_up(event.button.x, event.button.y, event.button.button == SDL_BUTTON_RIGHT, elapsed); + if (confirmation && !decision_screen.confirmation_dismissed()) rendered_phase = UINT64_MAX; + } } if (confirmation ? decision_screen.confirmation_dismissed() : decision_screen.outcome_dismissed()) return; SDL_Delay(10); diff --git a/src/ui/incoming_transfer.cpp b/src/ui/incoming_transfer.cpp index fcbfde5..adfa350 100644 --- a/src/ui/incoming_transfer.cpp +++ b/src/ui/incoming_transfer.cpp @@ -601,6 +601,7 @@ std::optional IncomingTransferScreen::pointer_up(int x, int y, bool right, // then the bid area (x 4..190, y from 0x8f, rows 0x11 pixels high). Empty slots, unsupported transactions // (except in the pending variant) and clicks after an answer are ignored. std::optional IncomingTransferScreen::click(int x, int y, bool right, uint64_t elapsed_ms) { + notice_pressed_ = false; // the release ends the pressed look if (confirmation_mode_) { if (!right && x >= 95 && x <= 220 && y >= 166 && y <= 176) confirmation_dismissed_ = true; @@ -676,7 +677,17 @@ void IncomingTransferScreen::draw_notice(Image& out) const { notice.body=state_.notice_text; notice.source_manager_flags=confirmation_mode_?0x80:0x40; draw_source_dialog(out,{widgets_,faces_,&badge_atlas_,body_,heading_,exe_, - sprite_font_,texts_},notice,gradient_text_); + sprite_font_,texts_},notice,gradient_text_, + notice_pressed_ ? std::optional(GameEndTaxDialog::Button::acknowledge) : std::nullopt); +} + +// Mouse DOWN on OK of a confirmation notice: drawn pressed until the release. Returns true when the picture changed. +bool IncomingTransferScreen::press(int x, int y) { + const bool on = confirmation_mode_ && !confirmation_dismissed_ && + source_dialog_button_at(TaxDialogKind::acknowledgement, false, x, y) == GameEndTaxDialog::Button::acknowledge; + const bool changed = on != notice_pressed_; + notice_pressed_ = on; + return changed; } } // namespace bmh::ui diff --git a/src/ui/incoming_transfer.hpp b/src/ui/incoming_transfer.hpp index 507d04f..e416414 100644 --- a/src/ui/incoming_transfer.hpp +++ b/src/ui/incoming_transfer.hpp @@ -151,6 +151,8 @@ public: void pointer_down(bool right = false); std::optional pointer_up(int x, int y, bool right = false, uint64_t elapsed_ms = 0); std::optional click(int x, int y, bool right = false, uint64_t elapsed_ms = 0); + // Mouse DOWN on OK of a confirmation: drawn pressed until the release (click()). + bool press(int x, int y); std::optional key(std::string_view name); bool dismiss_notice(); bool notice_active() const { return !state_.notice_text.empty() && notice_active_; } @@ -174,6 +176,7 @@ private: uint8_t outcome_speed_setting_ = 0; bool outcome_dismissed_ = false; bool confirmation_mode_ = false, confirmation_dismissed_ = false; + bool notice_pressed_ = false; // OK of the confirmation held down by the mouse std::optional confirmation_backdrop_; Image widgets_, faces_, badge_atlas_, seller_badge_atlas_;