mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-08 08:10:30 -10:00
menu: the input held back after a menu action waits for release, not for extra frames
When the menu opens or closes, a bind or a text entry ends, or the mouse clicks in the menu, input_driver_flushing_input holds the input back - from the menu, the hotkeys and the core - so that the press that did it does nothing more. The run loop counts it down on each frame with nothing held. Five of the six places set it to 2, which held input back for one more frame after everything had been let go. The comment gave the reason as input being ignored for a frame after some events, such as the on-screen keyboard closing. They set it to 1 now, as the mouse's already did: the input is held back until it is all let go, and not a frame longer. The wait for release stays; that is what keeps an A pressed on Resume out of the game. Run in the Linux build, with each key both tapped and held for a good part of a second: a search in Settings closed with Enter selects the match and does not open it; a hotkey bound by pressing Enter is bound once and does not start a second capture; the menu opened and closed with F1 held stays as it was put; Resume with Enter held goes back to the content and the menu stays shut. The frontend harness passes.
This commit is contained in:
1 parent
88adacf483
commit
b29c8f6fcf
2 files changed
+13
-14
No files matched your search
+8
-14
@@ -4766,10 +4766,8 @@ void menu_input_dialog_end(void)
|
||||
menu_st->input_dialog_kb_label_setting[0] = '\0';
|
||||
|
||||
/* Avoid triggering states on pressing return. */
|
||||
/* Inhibits input for 2 frames
|
||||
* > Required, since input is ignored for 1 frame
|
||||
* after certain events - e.g. closing the OSK */
|
||||
menu_st->input_driver_flushing_input = 2;
|
||||
/* Held back until everything held now is let go. */
|
||||
menu_st->input_driver_flushing_input = 1;
|
||||
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
/* Dismiss iOS/tvOS native keyboard if it's currently open */
|
||||
@@ -5150,10 +5148,8 @@ MENU_NOINLINE static bool menu_input_key_bind_iterate(
|
||||
if (_binds->begin > _binds->last)
|
||||
{
|
||||
/* Avoid new binds triggering things right away. */
|
||||
/* Inhibits input for 2 frames
|
||||
* > Required, since input is ignored for 1 frame
|
||||
* after certain events - e.g. closing the OSK */
|
||||
menu_st->input_driver_flushing_input = 2;
|
||||
/* Held back until everything held now is let go. */
|
||||
menu_st->input_driver_flushing_input = 1;
|
||||
|
||||
/* We won't be getting any key events, so just cancel early. */
|
||||
if (timed_out)
|
||||
@@ -5284,10 +5280,8 @@ MENU_NOINLINE static bool menu_input_key_bind_iterate(
|
||||
}
|
||||
|
||||
/* Avoid new binds triggering things right away. */
|
||||
/* Inhibits input for 2 frames
|
||||
* > Required, since input is ignored for 1 frame
|
||||
* after certain events - e.g. closing the OSK */
|
||||
menu_st->input_driver_flushing_input = 2;
|
||||
/* Held back until everything held now is let go. */
|
||||
menu_st->input_driver_flushing_input = 1;
|
||||
|
||||
/* Use human readable order instead */
|
||||
new_binds.order++;
|
||||
@@ -7026,7 +7020,7 @@ void retroarch_menu_running(void)
|
||||
}
|
||||
|
||||
/* Prevent stray input */
|
||||
menu_st->input_driver_flushing_input = 2;
|
||||
menu_st->input_driver_flushing_input = 1;
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if (audio_enable_menu && audio_enable_menu_bgm)
|
||||
@@ -7104,7 +7098,7 @@ void retroarch_menu_running_finished(bool quit)
|
||||
}
|
||||
|
||||
/* Prevent stray input */
|
||||
menu_st->input_driver_flushing_input = 2;
|
||||
menu_st->input_driver_flushing_input = 1;
|
||||
|
||||
if (!quit)
|
||||
{
|
||||
|
||||
@@ -543,6 +543,11 @@ struct menu_state
|
||||
|
||||
/* unsigned alignment */
|
||||
unsigned input_dialog_kb_idx;
|
||||
/* Nonzero: the input held now is held back - from the menu, the
|
||||
* hotkeys and the core - until it is all let go, which clears it.
|
||||
* Set when the menu opens or closes, a bind or a text entry ends,
|
||||
* and the mouse clicks, so that the press that did it does nothing
|
||||
* more. It is a wait for release and not a count of frames. */
|
||||
unsigned input_driver_flushing_input;
|
||||
menu_dialog_t dialog_st;
|
||||
enum menu_action prev_action;
|
||||
|
||||
Reference in new issue
Block a user