Refactor lock count handling in protopirate_receiver

This commit is contained in:
limbo111111 authored and GitHub committed 2026-01-14 20:08:54 +01:00
1 parent f78c153383
commit ff2acb36d5
1 file changed
+11 -9
+11 -9
View File
@@ -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;
}
},