summaryrefslogtreecommitdiff
path: root/src/w32inevt.c
diff options
context:
space:
mode:
authorGeoff Voelker <voelker@cs.washington.edu>1998-04-17 05:09:29 +0000
committerGeoff Voelker <voelker@cs.washington.edu>1998-04-17 05:09:29 +0000
commit1d0c62e9dbebc39fb4911e286b4b3316f75581e9 (patch)
tree18b75448471893f7bbb2e75cda4fe068e1d7e438 /src/w32inevt.c
parent066be249b0ca936f4b5302e97e6a9909130b418c (diff)
downloademacs-1d0c62e9dbebc39fb4911e286b4b3316f75581e9.tar.gz
(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.
Diffstat (limited to 'src/w32inevt.c')
-rw-r--r--src/w32inevt.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/w32inevt.c b/src/w32inevt.c
index dc3fdf301b8..adbff5a120b 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -52,6 +52,7 @@ extern Lisp_Object Vw32_alt_is_meta;
/* 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 @@ w32_kbd_mods_to_emacs (DWORD mods, WORD key)
{
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 @@ w32_kbd_mods_to_emacs (DWORD mods, WORD key)
/* 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 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event)
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 @@ static int map_virt_key[256] =
-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,