mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 04:36:23 +02:00
Work around Escape hotkey race with exit confirmation dialog
See merge request ryubing/ryujinx!54
This commit is contained in:
parent
90582e9e93
commit
512120db04
2 changed files with 21 additions and 0 deletions
|
@ -1152,6 +1152,24 @@ namespace Ryujinx.Ava.Systems
|
|||
|
||||
_dialogShown = true;
|
||||
|
||||
// The hard-coded hotkey mapped to exit is Escape, but it's also the same key
|
||||
// that causes the dialog we launch to close (without doing anything). In release
|
||||
// mode, a race is observed that between ShowExitPrompt() appearing on KeyDown
|
||||
// and the ContentDialog we create seeing the key state before KeyUp. Merely waiting
|
||||
// for the key to no longer be pressed appears to be insufficient.
|
||||
// NB: Using _keyboardInterface.IsPressed(Key.Escape) does not currently work.
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
while (GetAsyncKeyState(0x1B) != 0)
|
||||
{
|
||||
await Task.Delay(100);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Delay(250);
|
||||
}
|
||||
|
||||
shouldExit = await ContentDialogHelper.CreateStopEmulationDialog();
|
||||
|
||||
_dialogShown = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue