aboutsummaryrefslogtreecommitdiffstats
path: root/src/msdos.c
diff options
context:
space:
mode:
authorRichard M. Stallman1996-01-29 22:22:08 +0000
committerRichard M. Stallman1996-01-29 22:22:08 +0000
commit48ffe371ec5245f098fd02c05da201a3829baafa (patch)
treed7e0fdef5852637ebbb70d274cfa727ed5db8a7f /src/msdos.c
parent7e0846530ac6fee3b1ba8e304c1451a90d41e1a0 (diff)
downloademacs-48ffe371ec5245f098fd02c05da201a3829baafa.tar.gz
emacs-48ffe371ec5245f098fd02c05da201a3829baafa.zip
(dos_rawgetc): Allow simulation of `Mouse-3' by
simultaneous click/drag of `Mouse-1' and `Mouse-2'. (dos_set_window_size): Make the window size change faster for standard sizes. Fix a bug in v2-specific code to change window size.
Diffstat (limited to 'src/msdos.c')
-rw-r--r--src/msdos.c94
1 files changed, 60 insertions, 34 deletions
diff --git a/src/msdos.c b/src/msdos.c
index 0746a721075..6f175da71a8 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1,5 +1,5 @@
1/* MS-DOS specific C utilities. 1/* MS-DOS specific C utilities.
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. 2 Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -333,6 +333,7 @@ ScreenVisualBell (void)
333 333
334/* Set the screen dimensions so that it can show no less than 334/* Set the screen dimensions so that it can show no less than
335 ROWS x COLS frame. */ 335 ROWS x COLS frame. */
336
336void 337void
337dos_set_window_size (rows, cols) 338dos_set_window_size (rows, cols)
338 int *rows, *cols; 339 int *rows, *cols;
@@ -355,7 +356,7 @@ dos_set_window_size (rows, cols)
355 356
356 mouse_off (); 357 mouse_off ();
357 358
358 /* If the user specify a special video mode for these dimensions, 359 /* If the user specified a special video mode for these dimensions,
359 use that mode. */ 360 use that mode. */
360 sprintf (video_name, "screen-dimensions-%dx%d", *rows, *cols); 361 sprintf (video_name, "screen-dimensions-%dx%d", *rows, *cols);
361 video_mode = XSYMBOL (Fintern_soft (build_string (video_name), 362 video_mode = XSYMBOL (Fintern_soft (build_string (video_name),
@@ -369,6 +370,15 @@ dos_set_window_size (rows, cols)
369 regs.h.bl = 0; 370 regs.h.bl = 0;
370 regs.x.ax = 0x1003; 371 regs.x.ax = 0x1003;
371 int86 (0x10, &regs, &regs); 372 int86 (0x10, &regs, &regs);
373
374 if (have_mouse)
375 {
376 /* Must hardware-reset the mouse, or else it won't update
377 its notion of screen dimensions for some non-standard
378 video modes. This is *painfully* slow... */
379 regs.x.ax = 0;
380 int86 (0x33, &regs, &regs);
381 }
372 } 382 }
373 383
374 /* Find one of the dimensions supported by standard EGA/VGA 384 /* Find one of the dimensions supported by standard EGA/VGA
@@ -398,9 +408,10 @@ dos_set_window_size (rows, cols)
398 { 408 {
399 if (std_dimension[i].rows != current_rows 409 if (std_dimension[i].rows != current_rows
400 || *cols != current_cols) 410 || *cols != current_cols)
401 _set_screen_lines (*rows); 411 _set_screen_lines (std_dimension[i].rows);
402 break; 412 break;
403 } 413 }
414 i++;
404 } 415 }
405 } 416 }
406 417
@@ -442,10 +453,6 @@ dos_set_window_size (rows, cols)
442 453
443 if (have_mouse) 454 if (have_mouse)
444 { 455 {
445 /* Must hardware-reset the mouse, or else it won't update
446 its notion of screen dimensions. */
447 regs.x.ax = 0;
448 int86 (0x33, &regs, &regs);
449 mouse_init (); 456 mouse_init ();
450 mouse_on (); 457 mouse_on ();
451 } 458 }
@@ -455,10 +462,8 @@ dos_set_window_size (rows, cols)
455 *cols = ScreenCols (); 462 *cols = ScreenCols ();
456} 463}
457 464
458/* 465/* If we write a character in the position where the mouse is,
459 * If we write a character in the position where the mouse is, 466 the mouse cursor may need to be refreshed. */
460 * the mouse cursor may need to be refreshed.
461 */
462 467
463static void 468static void
464mouse_off_maybe () 469mouse_off_maybe ()
@@ -628,10 +633,11 @@ IT_update_end ()
628} 633}
629 634
630/* This was more or less copied from xterm.c */ 635/* This was more or less copied from xterm.c */
636
631static void 637static void
632IT_set_menu_bar_lines (window, n) 638IT_set_menu_bar_lines (window, n)
633 Lisp_Object window; 639 Lisp_Object window;
634 int n; 640 int n;
635{ 641{
636 struct window *w = XWINDOW (window); 642 struct window *w = XWINDOW (window);
637 643
@@ -651,10 +657,8 @@ IT_set_menu_bar_lines (window, n)
651 } 657 }
652} 658}
653 659
654/* 660/* IT_set_terminal_modes is called when emacs is started,
655 * IT_set_terminal_modes is called when emacs is started, 661 resumed, and whenever the screen is redrawn! */
656 * resumed, and whenever the screen is redrawn!
657 */
658 662
659static 663static
660IT_set_terminal_modes (void) 664IT_set_terminal_modes (void)
@@ -690,10 +694,8 @@ IT_set_terminal_modes (void)
690 screen_size_X, screen_size_Y); 694 screen_size_X, screen_size_Y);
691} 695}
692 696
693/* 697/* IT_reset_terminal_modes is called when emacs is
694 * IT_reset_terminal_modes is called when emacs is 698 suspended or killed. */
695 * suspended or killed.
696 */
697 699
698static 700static
699IT_reset_terminal_modes (void) 701IT_reset_terminal_modes (void)
@@ -825,7 +827,8 @@ IT_set_frame_parameters (frame, alist)
825#endif /* !HAVE_X_WINDOWS */ 827#endif /* !HAVE_X_WINDOWS */
826 828
827 829
828/* Do we need the internal terminal? */ 830/* Do we need the internal terminal? */
831
829void 832void
830internal_terminal_init () 833internal_terminal_init ()
831{ 834{
@@ -1343,6 +1346,7 @@ and then the scan code.")
1343} 1346}
1344 1347
1345/* Get a char from keyboard. Function keys are put into the event queue. */ 1348/* Get a char from keyboard. Function keys are put into the event queue. */
1349
1346static int 1350static int
1347dos_rawgetc () 1351dos_rawgetc ()
1348{ 1352{
@@ -1547,14 +1551,37 @@ dos_rawgetc ()
1547 for (but = 0; but < NUM_MOUSE_BUTTONS; but++) 1551 for (but = 0; but < NUM_MOUSE_BUTTONS; but++)
1548 for (press = 0; press < 2; press++) 1552 for (press = 0; press < 2; press++)
1549 { 1553 {
1554 int button_num = but;
1555
1550 if (press) 1556 if (press)
1551 ok = mouse_pressed (but, &x, &y); 1557 ok = mouse_pressed (but, &x, &y);
1552 else 1558 else
1553 ok = mouse_released (but, &x, &y); 1559 ok = mouse_released (but, &x, &y);
1554 if (ok) 1560 if (ok)
1555 { 1561 {
1562 /* Allow a simultaneous press/release of Mouse-1 and
1563 Mouse-2 to simulate Mouse-3 on two-button mice. */
1564 if (mouse_button_count == 2 && but < 2)
1565 {
1566 int x2, y2; /* don't clobber original coordinates */
1567
1568 /* If only one button is pressed, wait 100 msec and
1569 check again. This way, Speedy Gonzales isn't
1570 punished, while the slow get their chance. */
1571 if (press && mouse_pressed (1-but, &x2, &y2)
1572 || !press && mouse_released (1-but, &x2, &y2))
1573 button_num = 2;
1574 else
1575 {
1576 delay (100);
1577 if (press && mouse_pressed (1-but, &x2, &y2)
1578 || !press && mouse_released (1-but, &x2, &y2))
1579 button_num = 2;
1580 }
1581 }
1582
1556 event.kind = mouse_click; 1583 event.kind = mouse_click;
1557 event.code = but; 1584 event.code = button_num;
1558 event.modifiers = dos_get_modifiers (0) 1585 event.modifiers = dos_get_modifiers (0)
1559 | (press ? down_modifier : up_modifier); 1586 | (press ? down_modifier : up_modifier);
1560 event.x = x; 1587 event.x = x;
@@ -1572,6 +1599,7 @@ dos_rawgetc ()
1572static int prev_get_char = -1; 1599static int prev_get_char = -1;
1573 1600
1574/* Return 1 if a key is ready to be read without suspending execution. */ 1601/* Return 1 if a key is ready to be read without suspending execution. */
1602
1575dos_keysns () 1603dos_keysns ()
1576{ 1604{
1577 if (prev_get_char != -1) 1605 if (prev_get_char != -1)
@@ -1581,6 +1609,7 @@ dos_keysns ()
1581} 1609}
1582 1610
1583/* Read a key. Return -1 if no key is ready. */ 1611/* Read a key. Return -1 if no key is ready. */
1612
1584dos_keyread () 1613dos_keyread ()
1585{ 1614{
1586 if (prev_get_char != -1) 1615 if (prev_get_char != -1)
@@ -1705,7 +1734,7 @@ IT_menu_calc_size (XMenu *menu, int *width, int *height)
1705 *height = maxheight; 1734 *height = maxheight;
1706} 1735}
1707 1736
1708/* Display MENU at (X,Y) using FACES. */ 1737/* Display MENU at (X,Y) using FACES. */
1709 1738
1710static void 1739static void
1711IT_menu_display (XMenu *menu, int y, int x, int *faces) 1740IT_menu_display (XMenu *menu, int y, int x, int *faces)
@@ -2234,11 +2263,8 @@ install_ctrl_break_check ()
2234 } 2263 }
2235} 2264}
2236 2265
2237/* 2266/* Turn off Dos' Ctrl-C checking and inhibit interpretation of
2238 * Turn off Dos' Ctrl-C checking and inhibit interpretation of 2267 control chars by DOS. Determine the keyboard type. */
2239 * control chars by Dos.
2240 * Determine the keyboard type.
2241 */
2242 2268
2243int 2269int
2244dos_ttraw () 2270dos_ttraw ()
@@ -2315,6 +2341,7 @@ dos_ttraw ()
2315} 2341}
2316 2342
2317/* Restore status of standard input and Ctrl-C checking. */ 2343/* Restore status of standard input and Ctrl-C checking. */
2344
2318int 2345int
2319dos_ttcooked () 2346dos_ttcooked ()
2320{ 2347{
@@ -2334,6 +2361,7 @@ dos_ttcooked ()
2334/* Run command as specified by ARGV in directory DIR. 2361/* Run command as specified by ARGV in directory DIR.
2335 The command is run with input from TEMPIN, output to 2362 The command is run with input from TEMPIN, output to
2336 file TEMPOUT and stderr to TEMPERR. */ 2363 file TEMPOUT and stderr to TEMPERR. */
2364
2337int 2365int
2338run_msdos_command (argv, dir, tempin, tempout, temperr) 2366run_msdos_command (argv, dir, tempin, tempout, temperr)
2339 unsigned char **argv; 2367 unsigned char **argv;
@@ -2450,10 +2478,8 @@ croak (badfunc)
2450 * gettimeofday 2478 * gettimeofday
2451 */ 2479 */
2452 2480
2453/* 2481/* Hostnames for a pc are not really funny,
2454 * Hostnames for a pc are not really funny, 2482 but they are used in change log so we emulate the best we can. */
2455 * but they are used in change log so we emulate the best we can.
2456 */
2457 2483
2458gethostname (p, size) 2484gethostname (p, size)
2459 char *p; 2485 char *p;
@@ -2533,7 +2559,7 @@ Lisp_Object Vdos_display_time;
2533 2559
2534static void 2560static void
2535check_timer (t) 2561check_timer (t)
2536 struct time *t; 2562 struct time *t;
2537{ 2563{
2538 int sec, min, hour, hund; 2564 int sec, min, hour, hund;
2539 2565