changeset 21611:1a4fc4d9ca9a

(Vw32_recognize_altgr): Declare. (w32_kbd_mods_to_emacs): Obey Vw32_recognize_altgr. Add more keys for Vw32_capslock_is_shiftlock. (w32_kbd_patch_key): Obey Vw32_recognize_altgr. (map_virt_key): Brazilian keyboards use 0xc1 for /(?) key.
author Geoff Voelker <voelker@cs.washington.edu>
date Fri, 17 Apr 1998 05:09:29 +0000
parents f3fc92afc65b
children 24a01af0cd38
files src/w32inevt.c
diffstat 1 files changed, 29 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32inevt.c	Fri Apr 17 05:09:06 1998 +0000
+++ b/src/w32inevt.c	Fri Apr 17 05:09:29 1998 +0000
@@ -52,6 +52,7 @@
 
 /* from w32term */
 extern Lisp_Object Vw32_capslock_is_shiftlock;
+extern Lisp_Object Vw32_recognize_altgr;
 
 /* Event queue */
 #define EVENT_QUEUE_SIZE 50
@@ -103,8 +104,10 @@
 {
   int retval = 0;
 
-  /* If AltGr has been pressed, remove it.  */
-  if ((mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED)) 
+  /* If we recognize right-alt and left-ctrl as AltGr, and it has been
+     pressed, remove the modifiers.  */
+  if (!NILP (Vw32_recognize_altgr) 
+      && (mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED)) 
       == (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
     mods &= ~ (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED);
 
@@ -121,11 +124,24 @@
 
   /* Just in case someone wanted the original behaviour, make it
      optional by setting w32-capslock-is-shiftlock to t.  */
-  if (NILP (Vw32_capslock_is_shiftlock)
-      && ((key == VK_INSERT)
-	  || (key == VK_DELETE)
-	  || ((key >= VK_F1) && (key <= VK_F24))
-	  || ((key >= VK_PRIOR) && (key <= VK_DOWN))))
+  if (NILP (Vw32_capslock_is_shiftlock) &&
+#if 1
+      ( (key == VK_BACK) ||
+	(key == VK_TAB) ||
+	(key == VK_CLEAR) ||
+	(key == VK_RETURN) ||
+	(key == VK_ESCAPE) ||
+	( (key >= VK_SPACE) && (key <= VK_HELP)) ||
+	( (key >= VK_NUMPAD0) && (key <= VK_F24))
+	)
+#else
+      /* Perhaps easier to say which keys we *do* always want affected
+	 by capslock.  Not sure how this affects "alphabetic" keyboard
+	 input in non-English languages though - what virtual key codes
+	 are returned for accented letters, for instance?  */
+      !( (key >= '0' && key <= '9') || (key >= 'A' && key <= 'Z') )
+#endif
+      )
     {
       if ( (mods & SHIFT_PRESSED) == SHIFT_PRESSED)
 	retval |= shift_modifier;
@@ -164,7 +180,10 @@
     keystate[VK_SHIFT] = 0x80;
   if (mods & CAPSLOCK_ON) 
     keystate[VK_CAPITAL] = 1;
-  if ((mods & LEFT_CTRL_PRESSED) && (mods & RIGHT_ALT_PRESSED))
+  /* If we recognize right-alt and left-ctrl as AltGr, set the key
+     states accordingly before invoking ToAscii.  */
+  if (!NILP (Vw32_recognize_altgr)
+      && (mods & LEFT_CTRL_PRESSED) && (mods & RIGHT_ALT_PRESSED))
     {
       keystate[VK_CONTROL] = 0x80;
       keystate[VK_LCONTROL] = 0x80;
@@ -290,7 +309,8 @@
   -2,                 /* . */
   -2,                 /* / */
   -2,                 /* ` */
-      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xcf */
+      -2, /* 0xc1: on Brazilian keyboards, this is the /(?) key. */
+          -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xcf */
   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xda */
                                               -2, -2, -2, -2, -2, /* 0xdf */
   -2, -2, -2, -2, -2,