/* Initialize Grfx-Mode&Mouse.Try to use xres,yres,colors and font <fontname>. If you are successful, return a 1. If you can't initialize this mode, return a 0. */ int ws_initgrfx(int xres, int yres, int colors, const char *fontname) { static char pixels[2]; /* unsigned char value; Why? -jgk*/ GrBitmap pat_bm = { 0, 2, pixels, 1, 0, 0 }; if ( ( ws_private.textopt.txo_font = GrLoadFont( (char *)(fontname == NULL ? DEFAULT_FONT : fontname) ) ) == NULL ) { fprintf(errf, "Can't find font %s\n", fontname); return 0; } if ( !GrSetMode(GR_width_height_color_graphics, xres, yres, colors) ) { fprintf(errf, "Can't set grfx-mode. Try to load VESA-driver\n"); return 0; } if (GrSizeX() != xres || GrSizeY() != yres) { fprintf(errf, "Can't set grfx-mode. Try to load VESA-driver\n"); return 0; } GrClearScreen(0); if ( !GrMouseDetect() ) { fprintf(errf, "Can't find mouse\n"); return 0; } GrMouseInit(); GrMouseSetColors(255, 0); GrMouseDisplayCursor(); pixels[0] = 0x79; /* Prevent compiler warning for now */ pixels[1] = 0x55; ws_private.pat_box.gp_bitmap = pat_bm; /* value=_farpeekb(0x40,0x17); _farpokeb(0x40,0x17,value^0x20); */ return 1; }
int _GrEventInit(void) { char *s; kbd_init(); if (GrMouseDetect()) { mou_buttons = 0; } s = getenv("LANG"); if (strstr(s,"UTF-8")) kbsysencoding = GRENC_UTF_8; else { s = getenv("MGRXKBSYSENCODING"); if (s != NULL) kbsysencoding = GrFindEncoding(s); if (kbsysencoding < 0) kbsysencoding = GRENC_ISO_8859_1; } return 1; }