aboutsummaryrefslogtreecommitdiff
path: root/lib/libvgl/main.c
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2001-01-25 16:58:46 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2001-01-25 16:58:46 +0000
commitac6468bd086a1f23432f5a82a49100d04ce27561 (patch)
tree4cf617a6b9200a8e94fb300c90d2e2c09f995aa0 /lib/libvgl/main.c
parentacdb2839d6172abdc33a16d88f4c7490f4349b40 (diff)
downloadsrc-ac6468bd086a1f23432f5a82a49100d04ce27561.tar.gz
src-ac6468bd086a1f23432f5a82a49100d04ce27561.zip
Don't hardcode geometry of VESA_800x600 raster text mode (80x25). Instead save
actual geometry before switching to the graphics mode.
Notes
Notes: svn path=/head/; revision=71643
Diffstat (limited to 'lib/libvgl/main.c')
-rw-r--r--lib/libvgl/main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libvgl/main.c b/lib/libvgl/main.c
index c5b324cf5748..d1cab57f83a5 100644
--- a/lib/libvgl/main.c
+++ b/lib/libvgl/main.c
@@ -57,6 +57,7 @@ static int VGLSwitchPending;
static int VGLOnDisplay;
static unsigned int VGLCurWindow;
static int VGLInitDone = 0;
+static struct winsize VGLOldWSize;
void
VGLEnd()
@@ -79,8 +80,8 @@ struct vt_mode smode;
ioctl(0, _IO('V', VGLOldMode - M_VESA_BASE), 0);
if (VGLOldMode == M_VESA_800x600) {
int size[3];
- size[0] = 80;
- size[1] = 25;
+ size[0] = VGLOldWSize.ws_col;
+ size[1] = VGLOldWSize.ws_row;
size[2] = 16;
ioctl(0, KDRASTER, size);
}
@@ -144,6 +145,11 @@ VGLInit(int mode)
if (ioctl(0, CONS_MODEINFO, &VGLModeInfo)) /* FBIO_MODEINFO */
return -1;
+ /* If current mode is VESA_800x600 then save its geometry to restore later */
+ if ((VGLOldMode >= M_VESA_BASE) && (VGLOldMode == M_VESA_800x600))
+ if (ioctl(0, TIOCGWINSZ, &VGLOldWSize))
+ return -1;
+
VGLDisplay = (VGLBitmap *)malloc(sizeof(VGLBitmap));
if (VGLDisplay == NULL)
return -2;