Skip to content

Commit

Permalink
libnx: fix swkbd indefinitely showing up
Browse files Browse the repository at this point in the history
  • Loading branch information
natinusala committed Jan 7, 2020
1 parent 572611f commit b1ad601
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions retroarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -2620,6 +2620,15 @@ bool menu_input_dialog_start(menu_input_ctx_line_t *line)
bool menu_input_dialog_get_display_kb(void)
{
#ifdef HAVE_LIBNX
/* Indicates that we are "typing" from the swkbd
* result to RetroArch with repeated calls to input_keyboard_event
* This prevents input_keyboard_event from calling back
* menu_input_dialog_get_display_kb, looping indefinintely */
static bool typing = false;

if (typing)
return false;

SwkbdConfig kbd;
Result rc;

Expand Down Expand Up @@ -2647,6 +2656,7 @@ bool menu_input_dialog_get_display_kb(void)

/* RetroArch uses key-by-key input
so we need to simulate it */
typing = true;
for (i = 0; i < LIBNX_SWKBD_LIMIT; i++)
{
/* In case a previous "Enter" press closed the keyboard */
Expand All @@ -2670,6 +2680,7 @@ bool menu_input_dialog_get_display_kb(void)
if (menu_input_dialog_keyboard_display)
input_keyboard_event(true, '\n', '\n', 0, RETRO_DEVICE_KEYBOARD);

typing = false;
libnx_apply_overclock();
return false;
}
Expand Down

0 comments on commit b1ad601

Please sign in to comment.