diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-06-01 12:19:27 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-06-01 12:19:27 +0000 |
commit | d5526ebe894ddc8fa77703784a80e397188b5127 (patch) | |
tree | a219c16ca1fc0b8e6eecd25ed844d806cfb3acba /src/w32fns.c | |
parent | 183c3c592bb5a35cb39532a7a6db52ffc835edc0 (diff) | |
download | emacs-d5526ebe894ddc8fa77703784a80e397188b5127.tar.gz |
(reset_modifiers): Only clear a modifier if the modifier key has been
detected to have been released since Emacs lost focus.
(win32_wnd_proc): Have Windows translate VK_NUMLOCK and VK_SCROLL key
downs; don't reset the modifier state when Emacs loses focus.
Diffstat (limited to 'src/w32fns.c')
-rw-r--r-- | src/w32fns.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index b205baf4bbc..a2f1ed77d74 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1,5 +1,5 @@ /* Functions for the Win32 window system. - Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation. + Copyright (C) 1989, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -2755,9 +2755,28 @@ record_keyup (unsigned int wparam, unsigned int lparam) static void reset_modifiers () { + SHORT ctrl, alt; + if (!modifiers_recorded) return; - bzero (modifiers, sizeof (modifiers)); + + ctrl = GetAsyncKeyState (VK_CONTROL); + alt = GetAsyncKeyState (VK_MENU); + + if (ctrl == 0 || alt == 0) + /* Emacs doesn't have keyboard focus. Do nothing. */ + return; + + if (!(ctrl & 0x08000)) + /* Clear any recorded control modifier state. */ + modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0; + + if (!(alt & 0x08000)) + /* Clear any recorded alt modifier state. */ + modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; + + /* Otherwise, leave the modifier state as it was when Emacs lost + keyboard focus. */ } static int @@ -2950,6 +2969,8 @@ win32_wnd_proc (hwnd, msg, wParam, lParam) case VK_CONTROL: case VK_CAPITAL: case VK_SHIFT: + case VK_NUMLOCK: + case VK_SCROLL: windows_translate = 1; break; default: @@ -3185,9 +3206,9 @@ win32_wnd_proc (hwnd, msg, wParam, lParam) reset_modifiers (); goto dflt; - case WM_KILLFOCUS: case WM_SETFOCUS: reset_modifiers (); + case WM_KILLFOCUS: case WM_MOVE: case WM_SIZE: case WM_SYSCOMMAND: |