mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 20:15:03 -05:00
sockfilt.c: ignore non-key-events and continue waiting for input
This commit is contained in:
parent
eb01947e1d
commit
fe1c0176c1
@ -515,15 +515,24 @@ static void lograw(unsigned char *buffer, ssize_t len)
|
||||
*/
|
||||
static DWORD WINAPI select_ws_stdin_wait_thread(LPVOID lpParameter)
|
||||
{
|
||||
INPUT_RECORD inputrecord;
|
||||
HANDLE handle;
|
||||
DWORD mode;
|
||||
DWORD length;
|
||||
|
||||
handle = (HANDLE) lpParameter;
|
||||
|
||||
if(GetConsoleMode(handle, &mode))
|
||||
WaitForSingleObjectEx(handle, INFINITE, FALSE);
|
||||
if(GetConsoleMode(handle, &length)) {
|
||||
while(WaitForSingleObjectEx(handle, INFINITE, FALSE) == WAIT_OBJECT_0) {
|
||||
if(PeekConsoleInput(handle, &inputrecord, 1, &length)) {
|
||||
if(length == 1 && inputrecord.EventType != KEY_EVENT)
|
||||
ReadConsoleInput(handle, &inputrecord, 1, &length);
|
||||
else
|
||||
ReadFile(handle, NULL, 0, &mode, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
ReadFile(handle, NULL, 0, &length, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user