diff options
| author | Richard M. Stallman | 1994-05-02 07:52:49 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-05-02 07:52:49 +0000 |
| commit | 49a09c76b863e49833c1687a2536f4e5055c9977 (patch) | |
| tree | 0e70e4b259102ebbb24be4ef05060a3dc4ebae91 /src | |
| parent | 24ba360bb3db246d9a8129f9252419a62f1a7348 (diff) | |
| download | emacs-49a09c76b863e49833c1687a2536f4e5055c9977.tar.gz emacs-49a09c76b863e49833c1687a2536f4e5055c9977.zip | |
Finish downcasing mouse_init1, mouse_off,
mouse_check_moved, mouse_pressed, mouse_released, mouse_on, mouse_init.
(visible_bell): Now static. Make the asm volatile.
Don't expect register %gs to survive calls to other functions
(just to be safe, %gs will survive at present).
(glyph_to_pixel_coords, pixel_to_glyph_coords) new
functions imitating those in xterm.c.
(dos_rawgetc): Key numbers are biased by 0xff00.
Diffstat (limited to 'src')
| -rw-r--r-- | src/msdos.c | 125 |
1 files changed, 78 insertions, 47 deletions
diff --git a/src/msdos.c b/src/msdos.c index 9a30b379149..ad7d8b4e478 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -62,7 +62,7 @@ dos_ttraw () | |||
| 62 | break_stat = getcbrk (); | 62 | break_stat = getcbrk (); |
| 63 | setcbrk (0); | 63 | setcbrk (0); |
| 64 | install_ctrl_break_check (); | 64 | install_ctrl_break_check (); |
| 65 | have_mouse = Mouse_init1 (); | 65 | have_mouse = mouse_init1 (); |
| 66 | 66 | ||
| 67 | inregs.x.ax = 0x4400; /* Get IOCTL status. */ | 67 | inregs.x.ax = 0x4400; /* Get IOCTL status. */ |
| 68 | inregs.x.bx = 0x00; /* 0 = stdin. */ | 68 | inregs.x.bx = 0x00; /* 0 = stdin. */ |
| @@ -82,7 +82,7 @@ dos_ttcooked () | |||
| 82 | union REGS inregs, outregs; | 82 | union REGS inregs, outregs; |
| 83 | 83 | ||
| 84 | setcbrk (break_stat); | 84 | setcbrk (break_stat); |
| 85 | if (have_mouse) Mouse_off (); | 85 | if (have_mouse) mouse_off (); |
| 86 | 86 | ||
| 87 | inregs.x.ax = 0x4401; /* Set IOCTL status. */ | 87 | inregs.x.ax = 0x4401; /* Set IOCTL status. */ |
| 88 | inregs.x.bx = 0x00; /* 0 = stdin. */ | 88 | inregs.x.bx = 0x00; /* 0 = stdin. */ |
| @@ -314,7 +314,7 @@ dos_rawgetc () | |||
| 314 | if (code >= 0x100) | 314 | if (code >= 0x100) |
| 315 | { | 315 | { |
| 316 | event.kind = non_ascii_keystroke; | 316 | event.kind = non_ascii_keystroke; |
| 317 | event.code = code & 0xff; | 317 | event.code = (code & 0xff) + 0xff00; |
| 318 | } | 318 | } |
| 319 | else | 319 | else |
| 320 | { | 320 | { |
| @@ -330,9 +330,9 @@ dos_rawgetc () | |||
| 330 | event.code = c; | 330 | event.code = c; |
| 331 | } | 331 | } |
| 332 | event.modifiers | 332 | event.modifiers |
| 333 | = (shift_p ? shift_modifier : 0) | 333 | = (shift_p ? shift_modifier : 0 |
| 334 | + (ctrl_p ? ctrl_modifier : 0) | 334 | + (ctrl_p ? ctrl_modifier : 0 |
| 335 | + (alt_p ? meta_modifier : 0); | 335 | + (alt_p ? meta_modifier : 0))); |
| 336 | /* EMACS == Enter Meta Alt Control Shift */ | 336 | /* EMACS == Enter Meta Alt Control Shift */ |
| 337 | event.frame_or_window = selected_frame; | 337 | event.frame_or_window = selected_frame; |
| 338 | gettimeofday (&tv, NULL); | 338 | gettimeofday (&tv, NULL); |
| @@ -348,24 +348,24 @@ dos_rawgetc () | |||
| 348 | int but, press, x, y, ok; | 348 | int but, press, x, y, ok; |
| 349 | 349 | ||
| 350 | /* Check for mouse movement *before* buttons. */ | 350 | /* Check for mouse movement *before* buttons. */ |
| 351 | Mouse_check_moved (); | 351 | mouse_check_moved (); |
| 352 | 352 | ||
| 353 | for (but = 0; but < NUM_MOUSE_BUTTONS; but++) | 353 | for (but = 0; but < NUM_MOUSE_BUTTONS; but++) |
| 354 | for (press = 0; press < 2; press++) | 354 | for (press = 0; press < 2; press++) |
| 355 | { | 355 | { |
| 356 | if (press) | 356 | if (press) |
| 357 | ok = Mouse_pressed (but, &x, &y); | 357 | ok = mouse_pressed (but, &x, &y); |
| 358 | else | 358 | else |
| 359 | ok = Mouse_released (but, &x, &y); | 359 | ok = mouse_released (but, &x, &y); |
| 360 | if (ok) | 360 | if (ok) |
| 361 | { | 361 | { |
| 362 | event.kind = mouse_click; | 362 | event.kind = mouse_click; |
| 363 | event.code = but; | 363 | event.code = but; |
| 364 | event.modifiers | 364 | event.modifiers |
| 365 | = (shift_p ? shift_modifier : 0) | 365 | = (shift_p ? shift_modifier : 0 |
| 366 | + (ctrl_p ? ctrl_modifier : 0) | 366 | + (ctrl_p ? ctrl_modifier : 0 |
| 367 | + (alt_p ? meta_modifier : 0) | 367 | + (alt_p ? meta_modifier : 0 |
| 368 | + (press ? down_modifier : up_modifier); | 368 | + (press ? down_modifier : up_modifier)))); |
| 369 | event.x = x; | 369 | event.x = x; |
| 370 | event.y = y; | 370 | event.y = y; |
| 371 | event.frame_or_window = selected_frame; | 371 | event.frame_or_window = selected_frame; |
| @@ -743,46 +743,50 @@ init_environment (argc, argv, skip_args) | |||
| 743 | 743 | ||
| 744 | static unsigned char _xorattr; | 744 | static unsigned char _xorattr; |
| 745 | 745 | ||
| 746 | void | 746 | static void |
| 747 | visible_bell (xorattr) | 747 | visible_bell (xorattr) |
| 748 | unsigned char xorattr; | 748 | unsigned char xorattr; |
| 749 | { | 749 | { |
| 750 | _xorattr = xorattr; | 750 | _xorattr = xorattr; |
| 751 | asm (" pushl %eax | 751 | asm volatile |
| 752 | pushl %ebx | 752 | (" pushl %eax |
| 753 | pushl %ecx | 753 | pushl %ebx |
| 754 | pushl %edx | 754 | pushl %ecx |
| 755 | movl $1,%edx | 755 | pushl %edx |
| 756 | movl $1,%edx | ||
| 756 | visible_bell_0: | 757 | visible_bell_0: |
| 757 | movl _ScreenPrimary,%eax | 758 | call _ScreenRows |
| 758 | call dosmemsetup | 759 | pushl %eax |
| 759 | movl %eax,%ebx | 760 | call _ScreenCols |
| 760 | call _ScreenRows | 761 | pushl %eax |
| 761 | movl %eax,%ecx | 762 | movl _ScreenPrimary,%eax |
| 762 | call _ScreenCols | 763 | call dosmemsetup |
| 763 | imull %eax,%ecx | 764 | movl %eax,%ebx |
| 764 | movb (__xorattr),%al | 765 | popl %ecx |
| 765 | incl %ebx | 766 | popl %eax |
| 767 | imull %eax,%ecx | ||
| 768 | movb (__xorattr),%al | ||
| 769 | incl %ebx | ||
| 766 | visible_bell_1: | 770 | visible_bell_1: |
| 767 | xorb %al,%gs:(%ebx) | 771 | xorb %al,%gs:(%ebx) |
| 768 | addl $2,%ebx | 772 | addl $2,%ebx |
| 769 | decl %ecx | 773 | decl %ecx |
| 770 | jne visible_bell_1 | 774 | jne visible_bell_1 |
| 771 | decl %edx | 775 | decl %edx |
| 772 | jne visible_bell_3 | 776 | jne visible_bell_3 |
| 773 | visible_bell_2: | 777 | visible_bell_2: |
| 774 | movzwl %ax,%eax | 778 | movzwl %ax,%eax |
| 775 | movzwl %ax,%eax | 779 | movzwl %ax,%eax |
| 776 | movzwl %ax,%eax | 780 | movzwl %ax,%eax |
| 777 | movzwl %ax,%eax | 781 | movzwl %ax,%eax |
| 778 | decw %cx | 782 | decw %cx |
| 779 | jne visible_bell_2 | 783 | jne visible_bell_2 |
| 780 | jmp visible_bell_0 | 784 | jmp visible_bell_0 |
| 781 | visible_bell_3: | 785 | visible_bell_3: |
| 782 | popl %edx | 786 | popl %edx |
| 783 | popl %ecx | 787 | popl %ecx |
| 784 | popl %ebx | 788 | popl %ebx |
| 785 | popl %eax"); | 789 | popl %eax"); |
| 786 | } | 790 | } |
| 787 | 791 | ||
| 788 | static int internal_terminal = 0; | 792 | static int internal_terminal = 0; |
| @@ -799,7 +803,7 @@ internal_flush (f) | |||
| 799 | 803 | ||
| 800 | if (internal_terminal && f == stdout) | 804 | if (internal_terminal && f == stdout) |
| 801 | { | 805 | { |
| 802 | if (have_mouse) Mouse_off (); | 806 | if (have_mouse) mouse_off (); |
| 803 | cp = stdout->_base; | 807 | cp = stdout->_base; |
| 804 | count = stdout->_ptr - stdout->_base; | 808 | count = stdout->_ptr - stdout->_base; |
| 805 | while (count > 0) | 809 | while (count > 0) |
| @@ -867,7 +871,7 @@ internal_flush (f) | |||
| 867 | } | 871 | } |
| 868 | fpurge (stdout); | 872 | fpurge (stdout); |
| 869 | ScreenSetCursor (y, x); | 873 | ScreenSetCursor (y, x); |
| 870 | if (have_mouse) Mouse_on (); | 874 | if (have_mouse) mouse_on (); |
| 871 | } | 875 | } |
| 872 | else | 876 | else |
| 873 | /* This is a call to the original fflush. */ | 877 | /* This is a call to the original fflush. */ |
| @@ -1067,4 +1071,31 @@ mouse_init1 () | |||
| 1067 | return present; | 1071 | return present; |
| 1068 | } | 1072 | } |
| 1069 | 1073 | ||
| 1074 | /* See xterm.c for more info. */ | ||
| 1075 | void | ||
| 1076 | pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip) | ||
| 1077 | FRAME_PTR f; | ||
| 1078 | register int pix_x, pix_y; | ||
| 1079 | register int *x, *y; | ||
| 1080 | void /* XRectangle */ *bounds; | ||
| 1081 | int noclip; | ||
| 1082 | { | ||
| 1083 | if (bounds) abort (); | ||
| 1084 | |||
| 1085 | /* Ignore clipping. */ | ||
| 1086 | |||
| 1087 | *x = pix_x; | ||
| 1088 | *y = pix_y; | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | void | ||
| 1092 | glyph_to_pixel_coords (f, x, y, pix_x, pix_y) | ||
| 1093 | FRAME_PTR f; | ||
| 1094 | register int x, y; | ||
| 1095 | register int *pix_x, *pix_y; | ||
| 1096 | { | ||
| 1097 | *pix_x = x; | ||
| 1098 | *pix_y = y; | ||
| 1099 | } | ||
| 1100 | |||
| 1070 | #endif /* MSDOS */ | 1101 | #endif /* MSDOS */ |