summaryrefslogtreecommitdiff
path: root/src/w32fns.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-06-10 17:35:37 +0000
committerRichard M. Stallman <rms@gnu.org>1996-06-10 17:35:37 +0000
commit36f0dad1afbf1eb08ca1f83f6e63c201ce019884 (patch)
tree8aea0bddf0b7dbaa10b90877316464ef4e5f7943 /src/w32fns.c
parent22b6aab0a4c222d71fbd484d25ae124d8422810b (diff)
downloademacs-36f0dad1afbf1eb08ca1f83f6e63c201ce019884.tar.gz
(sync_modifiers): New function.
(w32_wnd_proc): Synchronize modifiers on each key down.
Diffstat (limited to 'src/w32fns.c')
-rw-r--r--src/w32fns.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index a2f1ed77d74..e3ad7a8f757 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2779,6 +2779,23 @@ reset_modifiers ()
keyboard focus. */
}
+/* Synchronize modifier state with what is reported with the current
+ keystroke. Even if we cannot distinguish between left and right
+ modifier keys, we know that, if no modifiers are set, then neither
+ the left or right modifier should be set. */
+static void
+sync_modifiers ()
+{
+ if (!modifiers_recorded)
+ return;
+
+ if (!(GetKeyState (VK_CONTROL) & 0x8000))
+ modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0;
+
+ if (!(GetKeyState (VK_MENU) & 0x8000))
+ modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0;
+}
+
static int
modifier_set (int vkey)
{
@@ -2948,6 +2965,9 @@ win32_wnd_proc (hwnd, msg, wParam, lParam)
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
+ /* Synchronize modifiers with current keystroke. */
+ sync_modifiers ();
+
record_keydown (wParam, lParam);
wParam = map_keypad_keys (wParam, lParam);