]> granicus.if.org Git - nethack/commitdiff
win32tty hung NetHack fix
authornethack.allison <nethack.allison>
Sat, 1 Nov 2003 23:56:24 +0000 (23:56 +0000)
committernethack.allison <nethack.allison>
Sat, 1 Nov 2003 23:56:24 +0000 (23:56 +0000)
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.

sys/winnt/nh340key.c
sys/winnt/nhdefkey.c
sys/winnt/nhraykey.c

index fd078269d7ce7ec612caaaf17d7cabed32b7f5d3..56e94ba0305cb5c930e9a6763012346999a3e4e7 100644 (file)
@@ -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))) {
index ec2e3905b5d4adf8e30944feeb824407c575ce19..9402471d40a2f520eb9b4c88fc699ef00d7a30c0 100644 (file)
@@ -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))) {
index e057d8d856d83c76d32f1905820d4a031773ab2c..66e744285ea1b36bad3af12ce8da33f422ee4e6c 100644 (file)
@@ -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))) {