Input: refactoring, platform agnostic key configuration.
Update input usage across project. Minor queue usage fixes and tick timings. (#330)
This commit is contained in:
@@ -43,11 +43,11 @@ static bool dialog_view_input_callback(InputEvent* event, void* context) {
|
||||
bool consumed = false;
|
||||
|
||||
// Process key presses only
|
||||
if(event->state && dialog->callback) {
|
||||
if(event->input == InputLeft) {
|
||||
if(event->type == InputTypeShort && dialog->callback) {
|
||||
if(event->key == InputKeyLeft) {
|
||||
dialog->callback(DialogResultLeft, dialog->context);
|
||||
consumed = true;
|
||||
} else if(event->input == InputRight) {
|
||||
} else if(event->key == InputKeyRight) {
|
||||
dialog->callback(DialogResultRight, dialog->context);
|
||||
consumed = true;
|
||||
}
|
||||
|
@@ -97,14 +97,14 @@ static bool dialog_ex_view_input_callback(InputEvent* event, void* context) {
|
||||
});
|
||||
|
||||
// Process key presses only
|
||||
if(event->state && dialog_ex->callback) {
|
||||
if(event->input == InputLeft && left_text != NULL) {
|
||||
if(event->type == InputTypeShort && dialog_ex->callback) {
|
||||
if(event->key == InputKeyLeft && left_text != NULL) {
|
||||
dialog_ex->callback(DialogExResultLeft, dialog_ex->context);
|
||||
consumed = true;
|
||||
} else if(event->input == InputOk && center_text != NULL) {
|
||||
} else if(event->key == InputKeyOk && center_text != NULL) {
|
||||
dialog_ex->callback(DialogExResultCenter, dialog_ex->context);
|
||||
consumed = true;
|
||||
} else if(event->input == InputRight && right_text != NULL) {
|
||||
} else if(event->key == InputKeyRight && right_text != NULL) {
|
||||
dialog_ex->callback(DialogExResultRight, dialog_ex->context);
|
||||
consumed = true;
|
||||
}
|
||||
|
@@ -83,7 +83,7 @@ static bool popup_view_input_callback(InputEvent* event, void* context) {
|
||||
bool consumed = false;
|
||||
|
||||
// Process key presses only
|
||||
if(event->state && popup->callback) {
|
||||
if(event->type == InputTypeShort && popup->callback) {
|
||||
popup->callback(popup->context);
|
||||
consumed = true;
|
||||
}
|
||||
|
@@ -74,17 +74,17 @@ static bool submenu_view_input_callback(InputEvent* event, void* context) {
|
||||
furi_assert(submenu);
|
||||
bool consumed = false;
|
||||
|
||||
if(event->state) {
|
||||
switch(event->input) {
|
||||
case InputUp:
|
||||
if(event->type == InputTypeShort) {
|
||||
switch(event->key) {
|
||||
case InputKeyUp:
|
||||
consumed = true;
|
||||
submenu_process_up(submenu);
|
||||
break;
|
||||
case InputDown:
|
||||
case InputKeyDown:
|
||||
consumed = true;
|
||||
submenu_process_down(submenu);
|
||||
break;
|
||||
case InputOk:
|
||||
case InputKeyOk:
|
||||
consumed = true;
|
||||
submenu_process_ok(submenu);
|
||||
break;
|
||||
|
@@ -289,25 +289,25 @@ static bool text_input_view_input_callback(InputEvent* event, void* context) {
|
||||
furi_assert(text_input);
|
||||
bool consumed = false;
|
||||
|
||||
if(event->state) {
|
||||
switch(event->input) {
|
||||
case InputUp:
|
||||
if(event->type == InputTypeShort) {
|
||||
switch(event->key) {
|
||||
case InputKeyUp:
|
||||
text_input_handle_up(text_input);
|
||||
consumed = true;
|
||||
break;
|
||||
case InputDown:
|
||||
case InputKeyDown:
|
||||
text_input_handle_down(text_input);
|
||||
consumed = true;
|
||||
break;
|
||||
case InputLeft:
|
||||
case InputKeyLeft:
|
||||
text_input_handle_left(text_input);
|
||||
consumed = true;
|
||||
break;
|
||||
case InputRight:
|
||||
case InputKeyRight:
|
||||
text_input_handle_right(text_input);
|
||||
consumed = true;
|
||||
break;
|
||||
case InputOk:
|
||||
case InputKeyOk:
|
||||
text_input_handle_ok(text_input);
|
||||
consumed = true;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user