Do not block in Get_input() when Quit_is_required is set

This commit is contained in:
Thomas Bernard 2019-02-04 19:11:30 +01:00
parent 48b9213da3
commit f8bfad2f34
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -1212,6 +1212,10 @@ int Get_input(int sleep_time)
// This is done in this function because it's called after reading
// some user input.
Flush_update();
if (Quit_is_required)
return 1;
Key_ANSI = 0;
Key_UNICODE = 0;
Key = 0;
@ -1601,7 +1605,11 @@ int Get_input(int sleep_time)
// some user input.
Flush_update();
while (!user_feedback_required && PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (Quit_is_required)
return 1;
while (!user_feedback_required && PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@ -1617,7 +1625,8 @@ int Get_input(int sleep_time)
if (user_feedback_required)
{
// Process the WM_CHAR event that follow WM_KEYDOWN
if(PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR, PM_REMOVE)) {
if(PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}