From d3fbc42330d954378d2514436c7db6aff81d04db Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 2 Aug 2021 09:08:53 +0100 Subject: win32: better detection of Alt key release Commit 7874ca73b (win32: allow characters to be entered as ALTNNN) made it possible to enter characters using Alt and a character code on the numeric pad. This required detecting the release of the Alt key. Sometimes this caused a problem when using Alt+Tab to cycle between applications. If Alt was released before Tab the code passed a tab character to the application. Avoid such issues by looking specifically for the release of the Alt key. --- win32/termios.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/win32/termios.c b/win32/termios.c index 708acfa9f..605f73328 100644 --- a/win32/termios.c +++ b/win32/termios.c @@ -40,7 +40,8 @@ int64_t FAST_FUNC read_key(int fd, char *buf UNUSED_PARAM, int timeout) state = record.Event.KeyEvent.dwControlKeyState; if (!record.Event.KeyEvent.bKeyDown) { /* ignore all key up events except Alt */ - if (alt_pressed && !(state & LEFT_ALT_PRESSED)) + if (alt_pressed && !(state & LEFT_ALT_PRESSED) && + record.Event.KeyEvent.wVirtualKeyCode == VK_MENU) alt_pressed = FALSE; else continue; -- cgit v1.2.3-55-g6feb