/* from w32term */
extern Lisp_Object Vw32_capslock_is_shiftlock;
+extern Lisp_Object Vw32_recognize_altgr;
/* Event queue */
#define EVENT_QUEUE_SIZE 50
{
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);
/* 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;
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;
-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,