Mercurial > emacs
comparison src/msdos.c @ 14284:0eaecdc13142
(dos_set_window_size): New function; switches the screen
to the size as close as possible to requested frame dimensions.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 24 Jan 1996 22:33:08 +0000 |
parents | 085bc709c11d |
children | 77ed54321a41 |
comparison
equal
deleted
inserted
replaced
14283:b747e8369639 | 14284:0eaecdc13142 |
---|---|
328 * 0x11) & 0x7f); | 328 * 0x11) & 0x7f); |
329 } | 329 } |
330 #endif | 330 #endif |
331 | 331 |
332 #ifndef HAVE_X_WINDOWS | 332 #ifndef HAVE_X_WINDOWS |
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 } | |
333 | 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. |
337 */ | 461 */ |