aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-08-02 09:08:53 +0100
committerRon Yorston <rmy@pobox.com>2021-08-02 09:19:10 +0100
commitd3fbc42330d954378d2514436c7db6aff81d04db (patch)
tree18057fe10e9f6ce0129db9b4fe87886518f36cd2
parent54d2ea4b479acb19580f90d70fb94e3329ac5d24 (diff)
downloadbusybox-w32-d3fbc42330d954378d2514436c7db6aff81d04db.tar.gz
busybox-w32-d3fbc42330d954378d2514436c7db6aff81d04db.tar.bz2
busybox-w32-d3fbc42330d954378d2514436c7db6aff81d04db.zip
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.
-rw-r--r--win32/termios.c3
1 files changed, 2 insertions, 1 deletions
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)
40 state = record.Event.KeyEvent.dwControlKeyState; 40 state = record.Event.KeyEvent.dwControlKeyState;
41 if (!record.Event.KeyEvent.bKeyDown) { 41 if (!record.Event.KeyEvent.bKeyDown) {
42 /* ignore all key up events except Alt */ 42 /* ignore all key up events except Alt */
43 if (alt_pressed && !(state & LEFT_ALT_PRESSED)) 43 if (alt_pressed && !(state & LEFT_ALT_PRESSED) &&
44 record.Event.KeyEvent.wVirtualKeyCode == VK_MENU)
44 alt_pressed = FALSE; 45 alt_pressed = FALSE;
45 else 46 else
46 continue; 47 continue;