win32tty hung NetHack fix
If a Key-down event didn't meet the expected criteria, the event was ignored in the "peek" loop, but it was never removed from the input queue either, so it remained at the top of the queue. It isn't clear if this fixes the dedicated arrow keys hanging, but if those were resulting in strange event values too, it just might.
This commit is contained in:
@@ -196,7 +196,11 @@ INPUT_RECORD *ir;
|
||||
if (ch || iskeypad(scan) || altseq) {
|
||||
done = 1; /* Stop looking */
|
||||
retval = 1; /* Found what we sought */
|
||||
} else {
|
||||
/* Strange Key event; let's purge it to avoid trouble */
|
||||
ReadConsoleInput(hConIn,ir,1,&count);
|
||||
}
|
||||
|
||||
}
|
||||
else if ((ir->EventType == MOUSE_EVENT &&
|
||||
(ir->Event.MouseEvent.dwButtonState & MOUSEMASK))) {
|
||||
|
||||
@@ -230,7 +230,11 @@ INPUT_RECORD *ir;
|
||||
if (ch || iskeypad(scan) || altseq) {
|
||||
done = 1; /* Stop looking */
|
||||
retval = 1; /* Found what we sought */
|
||||
} else {
|
||||
/* Strange Key event; let's purge it to avoid trouble */
|
||||
ReadConsoleInput(hConIn,ir,1,&count);
|
||||
}
|
||||
|
||||
}
|
||||
else if ((ir->EventType == MOUSE_EVENT &&
|
||||
(ir->Event.MouseEvent.dwButtonState & MOUSEMASK))) {
|
||||
|
||||
@@ -551,7 +551,11 @@ INPUT_RECORD *ir;
|
||||
if (ch || iskeypad(scan) || altseq) {
|
||||
done = 1; /* Stop looking */
|
||||
retval = 1; /* Found what we sought */
|
||||
} else {
|
||||
/* Strange Key event; let's purge it to avoid trouble */
|
||||
ReadConsoleInput(hConIn,ir,1,&count);
|
||||
}
|
||||
|
||||
}
|
||||
else if ((ir->EventType == MOUSE_EVENT &&
|
||||
(ir->Event.MouseEvent.dwButtonState & MOUSEMASK))) {
|
||||
|
||||
Reference in New Issue
Block a user