From 61997d7cea8c96ae66fc4066766cc9968e4fc91b Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Tue, 24 Aug 1993 06:27:19 +0000 Subject: [PATCH] - Fix C-M under Win 3.1. - Make interrupts flush typeahead correctly. --- v7/src/microcode/ntscreen.c | 55 ++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/v7/src/microcode/ntscreen.c b/v7/src/microcode/ntscreen.c index 221220b22..e900d0a81 100644 --- a/v7/src/microcode/ntscreen.c +++ b/v7/src/microcode/ntscreen.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: ntscreen.c,v 1.8 1993/08/11 20:28:55 adams Exp $ +$Id: ntscreen.c,v 1.9 1993/08/24 06:27:19 gjr Exp $ Copyright (c) 1993 Massachusetts Institute of Technology @@ -448,7 +448,14 @@ ScreenWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) int i; for (i=0; in_commands; i++) if (screen->commands[i].wID == wID) - return screen->commands[i].thunk(hWnd, wID); + { + void flush_typeahead (SCREEN); + LRESULT intrpt = (screen->commands[i].thunk(hWnd, wID)); + + if (intrpt) + flush_typeahead (screen); + return intrpt; + } return DefWindowProc (hWnd, uMsg, wParam, lParam); //return DefWindowProc (hWnd, wID>=0xf000?WM_SYSCOMMAND:WM_COMMAND, // wParam, lParam); @@ -1472,6 +1479,36 @@ ScreenPeekOrRead (SCREEN screen, int count, SCREEN_EVENT * buffer, BOOL remove) return (processed); } +void +flush_typeahead (SCREEN screen) +{ + SCREEN_EVENT_LINK ** next_loc, * last; + + next_loc = & screen->queue_head; + last = ((SCREEN_EVENT_LINK *) NULL); + + while ((* next_loc) != ((SCREEN_EVENT_LINK *) NULL)) + { + SCREEN_EVENT_LINK * current = (* next_loc); + + if (current->event.type != SCREEN_EVENT_TYPE_KEY) + { + last = current; + next_loc = ¤t->next; + } + else + { + (* next_loc) = current->next; + current->next = screen->free_events; + screen->free_events = current; + screen->n_events -= 1; + } + } + screen->queue_tail = last; + screen->n_chars = 0; + return; +} + //--------------------------------------------------------------------------- // BOOL ProcessScreenCharacter (HWND hWnd, int vk_code, int ch, DWORD lKeyData) // @@ -2906,8 +2943,14 @@ MIT_TranslateMessage (CONST MSG * lpmsg) return (MIT_post_char_message (lpmsg, ((WPARAM) ASCII_BS))); case VK_SPACE: - if (((GetKeyState (VK_RCONTROL)) < 0) - || ((GetKeyState (VK_LCONTROL)) < 0)) + if ( +#if 0 + ((GetKeyState (VK_RCONTROL)) < 0) + || ((GetKeyState (VK_LCONTROL)) < 0) +#else + (((DWORD) (GetKeyState (VK_CONTROL))) & 0x8000) != 0 +#endif + ) return (MIT_post_char_message (lpmsg, ((WPARAM) '\0'))); break; @@ -2928,8 +2971,12 @@ MIT_TranslateMessage (CONST MSG * lpmsg) WPARAM control_char; if (((message == WM_SYSKEYDOWN) || (lpmsg->lParam & KEYDATA_ALT_BIT)) +#if 0 && (((GetKeyState (VK_RCONTROL)) < 0) || ((GetKeyState (VK_LCONTROL)) < 0)) +#else + && ((((DWORD) (GetKeyState (VK_CONTROL))) & 0x8000) != 0) +#endif && (MIT_controlify (virtual_key, &control_char))) return (MIT_post_char_message (lpmsg, control_char)); break; -- 2.25.1