diff options
| author | Karl Heuer | 1996-01-24 22:33:08 +0000 |
|---|---|---|
| committer | Karl Heuer | 1996-01-24 22:33:08 +0000 |
| commit | 4a96d4d22d0b04c9a455a87206872162ff0b8fb5 (patch) | |
| tree | 83856f8827c6b3331992e213eb7f4c4319eb2524 /src | |
| parent | 40e23599627df85358b7e4fbea8e8c61be877aa9 (diff) | |
| download | emacs-4a96d4d22d0b04c9a455a87206872162ff0b8fb5.tar.gz emacs-4a96d4d22d0b04c9a455a87206872162ff0b8fb5.zip | |
(dos_set_window_size): New function; switches the screen
to the size as close as possible to requested frame dimensions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/msdos.c | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/src/msdos.c b/src/msdos.c index 7d406edcd5a..0746a721075 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -331,6 +331,130 @@ ScreenVisualBell (void) | |||
| 331 | 331 | ||
| 332 | #ifndef HAVE_X_WINDOWS | 332 | #ifndef HAVE_X_WINDOWS |
| 333 | 333 | ||
| 334 | /* Set the screen dimensions so that it can show no less than | ||
| 335 | ROWS x COLS frame. */ | ||
| 336 | void | ||
| 337 | dos_set_window_size (rows, cols) | ||
| 338 | int *rows, *cols; | ||
| 339 | { | ||
| 340 | char video_name[30]; | ||
| 341 | Lisp_Object video_mode; | ||
| 342 | int video_mode_value; | ||
| 343 | int have_vga = 0; | ||
| 344 | union REGS regs; | ||
| 345 | int current_rows = ScreenRows (), current_cols = ScreenCols (); | ||
| 346 | |||
| 347 | if (*rows == current_rows && *cols == current_cols) | ||
| 348 | return; | ||
| 349 | |||
| 350 | /* Do we have a VGA? */ | ||
| 351 | regs.x.ax = 0x1a00; | ||
| 352 | int86 (0x10, ®s, ®s); | ||
| 353 | if (regs.h.al == 0x1a && regs.h.bl > 5 && regs.h.bl < 13) | ||
| 354 | have_vga = 1; | ||
| 355 | |||
| 356 | mouse_off (); | ||
| 357 | |||
| 358 | /* If the user specify a special video mode for these dimensions, | ||
| 359 | use that mode. */ | ||
| 360 | sprintf (video_name, "screen-dimensions-%dx%d", *rows, *cols); | ||
| 361 | video_mode = XSYMBOL (Fintern_soft (build_string (video_name), | ||
| 362 | Qnil))-> value; | ||
| 363 | |||
| 364 | if (INTEGERP (video_mode) | ||
| 365 | && (video_mode_value = XINT (video_mode)) > 0) | ||
| 366 | { | ||
| 367 | regs.x.ax = video_mode_value; | ||
| 368 | int86 (0x10, ®s, ®s); | ||
| 369 | regs.h.bl = 0; | ||
| 370 | regs.x.ax = 0x1003; | ||
| 371 | int86 (0x10, ®s, ®s); | ||
| 372 | } | ||
| 373 | |||
| 374 | /* Find one of the dimensions supported by standard EGA/VGA | ||
| 375 | which gives us at least the required dimensions. */ | ||
| 376 | |||
| 377 | #if __DJGPP__ > 1 | ||
| 378 | |||
| 379 | else | ||
| 380 | { | ||
| 381 | static struct { | ||
| 382 | int rows; | ||
| 383 | int need_vga; | ||
| 384 | } std_dimension[] = { | ||
| 385 | {25, 0}, | ||
| 386 | {28, 1}, | ||
| 387 | {35, 0}, | ||
| 388 | {40, 1}, | ||
| 389 | {43, 0}, | ||
| 390 | {50, 1} | ||
| 391 | }; | ||
| 392 | int i = 0; | ||
| 393 | |||
| 394 | while (i < sizeof (std_dimension) / sizeof (std_dimension[0])) | ||
| 395 | { | ||
| 396 | if (std_dimension[i].need_vga <= have_vga | ||
| 397 | && std_dimension[i].rows >= *rows) | ||
| 398 | { | ||
| 399 | if (std_dimension[i].rows != current_rows | ||
| 400 | || *cols != current_cols) | ||
| 401 | _set_screen_lines (*rows); | ||
| 402 | break; | ||
| 403 | } | ||
| 404 | } | ||
| 405 | } | ||
| 406 | |||
| 407 | #else /* not __DJGPP__ > 1 */ | ||
| 408 | |||
| 409 | else if (*rows <= 25) | ||
| 410 | { | ||
| 411 | if (current_rows != 25 || current_cols != 80) | ||
| 412 | { | ||
| 413 | regs.x.ax = 3; | ||
| 414 | int86 (0x10, ®s, ®s); | ||
| 415 | regs.x.ax = 0x1101; | ||
| 416 | regs.h.bl = 0; | ||
| 417 | int86 (0x10, ®s, ®s); | ||
| 418 | regs.x.ax = 0x1200; | ||
| 419 | regs.h.bl = 32; | ||
| 420 | int86 (0x10, ®s, ®s); | ||
| 421 | regs.x.ax = 3; | ||
| 422 | int86 (0x10, ®s, ®s); | ||
| 423 | } | ||
| 424 | } | ||
| 425 | else if (*rows <= 50) | ||
| 426 | if (have_vga && (current_rows != 50 || current_cols != 80) | ||
| 427 | || *rows <= 43 && (current_rows != 43 || current_cols != 80)) | ||
| 428 | { | ||
| 429 | regs.x.ax = 3; | ||
| 430 | int86 (0x10, ®s, ®s); | ||
| 431 | regs.x.ax = 0x1112; | ||
| 432 | regs.h.bl = 0; | ||
| 433 | int86 (0x10, ®s, ®s); | ||
| 434 | regs.x.ax = 0x1200; | ||
| 435 | regs.h.bl = 32; | ||
| 436 | int86 (0x10, ®s, ®s); | ||
| 437 | regs.x.ax = 0x0100; | ||
| 438 | regs.x.cx = 7; | ||
| 439 | int86 (0x10, ®s, ®s); | ||
| 440 | } | ||
| 441 | #endif /* not __DJGPP__ > 1 */ | ||
| 442 | |||
| 443 | if (have_mouse) | ||
| 444 | { | ||
| 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, ®s, ®s); | ||
| 449 | mouse_init (); | ||
| 450 | mouse_on (); | ||
| 451 | } | ||
| 452 | |||
| 453 | /* Tell the caller what dimensions have been REALLY set. */ | ||
| 454 | *rows = ScreenRows (); | ||
| 455 | *cols = ScreenCols (); | ||
| 456 | } | ||
| 457 | |||
| 334 | /* | 458 | /* |
| 335 | * 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, |
| 336 | * the mouse cursor may need to be refreshed. | 460 | * the mouse cursor may need to be refreshed. |