aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeoff Voelker1998-04-17 05:09:29 +0000
committerGeoff Voelker1998-04-17 05:09:29 +0000
commitc0f1b02e2be15bc48072adb419e48dfbaf0965af (patch)
tree68e9fd5ff10c24f4c96a153ed58ec8f954930a5c /src
parent3f3e462972cdf923186843b70e0838c54aa5782b (diff)
downloademacs-c0f1b02e2be15bc48072adb419e48dfbaf0965af.tar.gz
emacs-c0f1b02e2be15bc48072adb419e48dfbaf0965af.zip
(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')
-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;
52 52
53/* from w32term */ 53/* from w32term */
54extern Lisp_Object Vw32_capslock_is_shiftlock; 54extern Lisp_Object Vw32_capslock_is_shiftlock;
55extern Lisp_Object Vw32_recognize_altgr;
55 56
56/* Event queue */ 57/* Event queue */
57#define EVENT_QUEUE_SIZE 50 58#define EVENT_QUEUE_SIZE 50
@@ -103,8 +104,10 @@ w32_kbd_mods_to_emacs (DWORD mods, WORD key)
103{ 104{
104 int retval = 0; 105 int retval = 0;
105 106
106 /* If AltGr has been pressed, remove it. */ 107 /* If we recognize right-alt and left-ctrl as AltGr, and it has been
107 if ((mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED)) 108 pressed, remove the modifiers. */
109 if (!NILP (Vw32_recognize_altgr)
110 && (mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
108 == (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED)) 111 == (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
109 mods &= ~ (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED); 112 mods &= ~ (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED);
110 113
@@ -121,11 +124,24 @@ w32_kbd_mods_to_emacs (DWORD mods, WORD key)
121 124
122 /* Just in case someone wanted the original behaviour, make it 125 /* Just in case someone wanted the original behaviour, make it
123 optional by setting w32-capslock-is-shiftlock to t. */ 126 optional by setting w32-capslock-is-shiftlock to t. */
124 if (NILP (Vw32_capslock_is_shiftlock) 127 if (NILP (Vw32_capslock_is_shiftlock) &&
125 && ((key == VK_INSERT) 128#if 1
126 || (key == VK_DELETE) 129 ( (key == VK_BACK) ||
127 || ((key >= VK_F1) && (key <= VK_F24)) 130 (key == VK_TAB) ||
128 || ((key >= VK_PRIOR) && (key <= VK_DOWN)))) 131 (key == VK_CLEAR) ||
132 (key == VK_RETURN) ||
133 (key == VK_ESCAPE) ||
134 ( (key >= VK_SPACE) && (key <= VK_HELP)) ||
135 ( (key >= VK_NUMPAD0) && (key <= VK_F24))
136 )
137#else
138 /* Perhaps easier to say which keys we *do* always want affected
139 by capslock. Not sure how this affects "alphabetic" keyboard
140 input in non-English languages though - what virtual key codes
141 are returned for accented letters, for instance? */
142 !( (key >= '0' && key <= '9') || (key >= 'A' && key <= 'Z') )
143#endif
144 )
129 { 145 {
130 if ( (mods & SHIFT_PRESSED) == SHIFT_PRESSED) 146 if ( (mods & SHIFT_PRESSED) == SHIFT_PRESSED)
131 retval |= shift_modifier; 147 retval |= shift_modifier;
@@ -164,7 +180,10 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event)
164 keystate[VK_SHIFT] = 0x80; 180 keystate[VK_SHIFT] = 0x80;
165 if (mods & CAPSLOCK_ON) 181 if (mods & CAPSLOCK_ON)
166 keystate[VK_CAPITAL] = 1; 182 keystate[VK_CAPITAL] = 1;
167 if ((mods & LEFT_CTRL_PRESSED) && (mods & RIGHT_ALT_PRESSED)) 183 /* If we recognize right-alt and left-ctrl as AltGr, set the key
184 states accordingly before invoking ToAscii. */
185 if (!NILP (Vw32_recognize_altgr)
186 && (mods & LEFT_CTRL_PRESSED) && (mods & RIGHT_ALT_PRESSED))
168 { 187 {
169 keystate[VK_CONTROL] = 0x80; 188 keystate[VK_CONTROL] = 0x80;
170 keystate[VK_LCONTROL] = 0x80; 189 keystate[VK_LCONTROL] = 0x80;
@@ -290,7 +309,8 @@ static int map_virt_key[256] =
290 -2, /* . */ 309 -2, /* . */
291 -2, /* / */ 310 -2, /* / */
292 -2, /* ` */ 311 -2, /* ` */
293 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xcf */ 312 -2, /* 0xc1: on Brazilian keyboards, this is the /(?) key. */
313 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xcf */
294 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xda */ 314 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xda */
295 -2, -2, -2, -2, -2, /* 0xdf */ 315 -2, -2, -2, -2, -2, /* 0xdf */
296 -2, -2, -2, -2, -2, 316 -2, -2, -2, -2, -2,