From ff2acb36d58fc810c10443fb325e1e0a63b32d9d Mon Sep 17 00:00:00 2001 From: limbo111111 <228673403+limbo111111@users.noreply.github.com> Date: Wed, 14 Jan 2026 20:08:54 +0100 Subject: [PATCH] Refactor lock count handling in protopirate_receiver --- views/protopirate_receiver.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/views/protopirate_receiver.c b/views/protopirate_receiver.c index 77accdc..a9e3b90 100644 --- a/views/protopirate_receiver.c +++ b/views/protopirate_receiver.c @@ -363,17 +363,19 @@ bool protopirate_view_receiver_input(InputEvent* event, void* context) { receiver->view, ProtoPirateReceiverModel * model, { - if(event->type == InputTypeShort && event->key == InputKeyBack) { - model->lock_count++; - if(model->lock_count >= UNLOCK_CNT) { - model->lock = ProtoPirateLockOff; - model->lock_count = 0; - if(receiver->callback) { - receiver->callback( - ProtoPirateCustomEventViewReceiverUnlock, receiver->context); + if(event->key == InputKeyBack) { + if(event->type == InputTypeShort) { + model->lock_count++; + if(model->lock_count >= UNLOCK_CNT) { + model->lock = ProtoPirateLockOff; + model->lock_count = 0; + if(receiver->callback) { + receiver->callback( + ProtoPirateCustomEventViewReceiverUnlock, receiver->context); + } } } - } else { + } else if(event->type == InputTypeShort || event->type == InputTypeLong || event->type == InputTypePress) { model->lock_count = 0; } },