changeset 15377:65d9ff2c8602

(sync_modifiers): New function. (w32_wnd_proc): Synchronize modifiers on each key down.
author Richard M. Stallman <rms@gnu.org>
date Mon, 10 Jun 1996 17:35:37 +0000
parents 73d3ebc6aecd
children ecfc288350ab
files src/w32fns.c
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32fns.c	Mon Jun 10 17:32:13 1996 +0000
+++ b/src/w32fns.c	Mon Jun 10 17:35:37 1996 +0000
@@ -2779,6 +2779,23 @@
      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 @@
 
     case WM_KEYDOWN:
     case WM_SYSKEYDOWN:
+      /* Synchronize modifiers with current keystroke.  */
+      sync_modifiers ();
+
       record_keydown (wParam, lParam);
 
       wParam = map_keypad_keys (wParam, lParam);