aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-05-24 19:46:40 +0000
committerRichard M. Stallman1994-05-24 19:46:40 +0000
commit9da6e7653b350c4b6ae674786b408aa42b667616 (patch)
tree520ef830e8ae3ef0057fc27a4784741c23d1ce34 /src
parent1df16e382080b46408162f61a16fafc06be52a42 (diff)
downloademacs-9da6e7653b350c4b6ae674786b408aa42b667616.tar.gz
emacs-9da6e7653b350c4b6ae674786b408aa42b667616.zip
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
independent. Make modifiers work with mouse. Improve C-S-<ascii> handling by using look-up tables. Fix kp-decimal problem.
Diffstat (limited to 'src')
-rw-r--r--src/msdos.c49
1 files changed, 33 insertions, 16 deletions
diff --git a/src/msdos.c b/src/msdos.c
index f1f1c388aec..19da6103676 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1,5 +1,5 @@
1/* MS-DOS specific C utilities. Coded by Morten Welinder 1993 1/* MS-DOS specific C utilities.
2 Copyright (C) 1993 Free Software Foundation, Inc. 2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to 17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 19
20/* Contributed by Morten Welinder */
21
20/* Note: some of the stuff here was taken from end of sysdep.c in demacs. */ 22/* Note: some of the stuff here was taken from end of sysdep.c in demacs. */
21 23
22#include <config.h> 24#include <config.h>
@@ -258,6 +260,9 @@ dos_rawgetc ()
258 int86 (0x16, &regs, &regs); 260 int86 (0x16, &regs, &regs);
259 ctrl_p = ((regs.h.al & 4) != 0); 261 ctrl_p = ((regs.h.al & 4) != 0);
260 shift_p = ((regs.h.al & 3) != 0); 262 shift_p = ((regs.h.al & 3) != 0);
263 /* Please be very careful here not to break international keyboard support.
264 When Keyb.Com is loaded, the key marked `Alt Gr' is used for accessing
265 characters like { and } if their positions are overlaid. */
261 alt_p = ((extended_kbd ? (regs.h.ah & 2) : (regs.h.al & 8)) != 0); 266 alt_p = ((extended_kbd ? (regs.h.ah & 2) : (regs.h.al & 8)) != 0);
262 267
263 while (kbhit ()) 268 while (kbhit ())
@@ -274,6 +279,11 @@ dos_rawgetc ()
274 /* Determine from the scan code if a keypad key was pressed. */ 279 /* Determine from the scan code if a keypad key was pressed. */
275 if (c >= '0' && c <= '9' && sc > 0xb) 280 if (c >= '0' && c <= '9' && sc > 0xb)
276 sc = (c == '0') ? 0xb : (c - '0' + 1), c = 0; 281 sc = (c == '0') ? 0xb : (c - '0' + 1), c = 0;
282 else if (sc == 0x53 && c != 0xe0)
283 {
284 code = 0xffae; /* Keypad decimal point/comma. */
285 goto nonascii;
286 }
277 else if (sc == 0xe0) 287 else if (sc == 0xe0)
278 { 288 {
279 switch (c) 289 switch (c)
@@ -282,10 +292,6 @@ dos_rawgetc ()
282 case 13: 292 case 13:
283 sc = 0x1c; 293 sc = 0x1c;
284 break; 294 break;
285 case '.': /* Decimal point or decimal comma */
286 case ',':
287 sc = 0x53;
288 break;
289 case '/': 295 case '/':
290 sc = 0x35; 296 sc = 0x35;
291 break; 297 break;
@@ -313,15 +319,26 @@ dos_rawgetc ()
313 { 319 {
314 if (code >= 0x100) 320 if (code >= 0x100)
315 { 321 {
322 nonascii:
316 event.kind = non_ascii_keystroke; 323 event.kind = non_ascii_keystroke;
317 event.code = (code & 0xff) + 0xff00; 324 event.code = (code & 0xff) + 0xff00;
318 } 325 }
319 else 326 else
320 { 327 {
321 /* Don't return S- if we don't have to. */ 328 /* Don't return S- if we don't have to. `shifted' is
322 if (code >= 'a' && code <= 'z') 329 supposed to be the shifted versions of the characters
330 in `unshifted'. Unfortunately, this is only true for
331 US keyboard layout. If anyone knows how to do this
332 right, please tell us. */
333 static char *unshifted
334 = "abcdefghijklmnopqrstuvwxyz,./=;[\\]'-`0123456789";
335 static char *shifted
336 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ<>?+:{|}\"_~)!@#$%^&*(";
337 char *pos;
338
339 if (shift_p && (pos = strchr (unshifted, code)))
323 { 340 {
324 c = shift_p ? toupper (code) : code; 341 c = shifted[pos - unshifted];
325 shift_p = 0; 342 shift_p = 0;
326 } 343 }
327 else 344 else
@@ -330,9 +347,9 @@ dos_rawgetc ()
330 event.code = c; 347 event.code = c;
331 } 348 }
332 event.modifiers 349 event.modifiers
333 = (shift_p ? shift_modifier : 0 350 = (shift_p ? shift_modifier : 0)
334 + (ctrl_p ? ctrl_modifier : 0 351 + (ctrl_p ? ctrl_modifier : 0)
335 + (alt_p ? meta_modifier : 0))); 352 + (alt_p ? meta_modifier : 0);
336 /* EMACS == Enter Meta Alt Control Shift */ 353 /* EMACS == Enter Meta Alt Control Shift */
337 event.frame_or_window = selected_frame; 354 event.frame_or_window = selected_frame;
338 gettimeofday (&tv, NULL); 355 gettimeofday (&tv, NULL);
@@ -362,10 +379,10 @@ dos_rawgetc ()
362 event.kind = mouse_click; 379 event.kind = mouse_click;
363 event.code = but; 380 event.code = but;
364 event.modifiers 381 event.modifiers
365 = (shift_p ? shift_modifier : 0 382 = (shift_p ? shift_modifier : 0)
366 + (ctrl_p ? ctrl_modifier : 0 383 + (ctrl_p ? ctrl_modifier : 0)
367 + (alt_p ? meta_modifier : 0 384 + (alt_p ? meta_modifier : 0)
368 + (press ? down_modifier : up_modifier)))); 385 + (press ? down_modifier : up_modifier);
369 event.x = x; 386 event.x = x;
370 event.y = y; 387 event.y = y;
371 event.frame_or_window = selected_frame; 388 event.frame_or_window = selected_frame;