Added patches from FreeBSD ports
authorSam Lantinga <slouken@lokigames.com>
Tue, 19 Jun 2001 13:33:54 +0000
changeset 75b0ae59d0f3ee
parent 74 6e28dae59e3b
child 76 f28fa29a3a0c
Added patches from FreeBSD ports
configure.in
docs.html
src/video/Makefile.am
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/svga/SDL_svgaevents.c
src/video/vgl/Makefile.am
src/video/vgl/SDL_vglevents.c
src/video/vgl/SDL_vglevents_c.h
src/video/vgl/SDL_vglmouse.c
src/video/vgl/SDL_vglmouse_c.h
src/video/vgl/SDL_vglvideo.c
src/video/vgl/SDL_vglvideo.h
src/video/x11/SDL_x11events.c
     1.1 --- a/configure.in	Sat Jun 16 06:47:45 2001 +0000
     1.2 +++ b/configure.in	Tue Jun 19 13:33:54 2001 +0000
     1.3 @@ -749,6 +749,37 @@
     1.4      fi
     1.5  }
     1.6  
     1.7 +dnl Find the VGL includes and libraries
     1.8 +CheckVGL()
     1.9 +{
    1.10 +    AC_ARG_ENABLE(video-vgl,
    1.11 +[  --enable-video-vgl     use VGL video driver [default=no]],
    1.12 +                  , enable_video_vgl=no)
    1.13 +    if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
    1.14 +        AC_MSG_CHECKING(for libVGL support)
    1.15 +        video_vgl=no
    1.16 +        AC_TRY_COMPILE([
    1.17 +         #include <sys/fbio.h>
    1.18 +         #include <sys/consio.h>
    1.19 +         #include <sys/kbio.h>
    1.20 +         #include <vgl.h>
    1.21 +        ],[
    1.22 +         VGLBitmap bitmap;
    1.23 +         exit(bitmap.PyxelBytes);
    1.24 +        ],[
    1.25 +        video_vgl=yes
    1.26 +        ])
    1.27 +        AC_MSG_RESULT($video_vgl)
    1.28 +        if test x$video_vgl = xyes; then
    1.29 +            CFLAGS="$CFLAGS -DENABLE_VGL"
    1.30 +            SYSTEM_LIBS="$SYSTEM_LIBS -lvgl"
    1.31 +
    1.32 +            VIDEO_SUBDIRS="$VIDEO_SUBDIRS vgl"
    1.33 +            VIDEO_DRIVERS="$VIDEO_DRIVERS vgl/libvideo_vgl.la"
    1.34 +        fi
    1.35 +    fi
    1.36 +}
    1.37 +
    1.38  dnl Find the AAlib includes
    1.39  CheckAAlib()
    1.40  {
    1.41 @@ -1202,6 +1233,7 @@
    1.42          CheckX11
    1.43          CheckDGA
    1.44          CheckSVGA
    1.45 +        CheckVGL
    1.46          CheckAAlib
    1.47          CheckOpenGL
    1.48          CheckPTHREAD
    1.49 @@ -2044,6 +2076,7 @@
    1.50  src/video/macrom/Makefile
    1.51  src/video/quartz/Makefile
    1.52  src/video/svga/Makefile
    1.53 +src/video/vgl/Makefile
    1.54  src/video/aalib/Makefile
    1.55  src/video/wincommon/Makefile
    1.56  src/video/windib/Makefile
     2.1 --- a/docs.html	Sat Jun 16 06:47:45 2001 +0000
     2.2 +++ b/docs.html	Tue Jun 19 13:33:54 2001 +0000
     2.3 @@ -16,6 +16,7 @@
     2.4  Major changes since SDL 1.0.0:
     2.5  </H2>
     2.6  <UL>
     2.7 +	<LI> 1.2.2: Added FreeBSD VGL video driver from FreeBSD ports
     2.8  	<LI> 1.2.1: Added Linux PlayStation 2 Graphics Synthesizer support
     2.9  	<LI> 1.2.1: Added an audio driver that writes to disk (thanks Ryan!)
    2.10  	<LI> 1.2.1: Mouse wheel sends mouse button (4/5) events on Windows
     3.1 --- a/src/video/Makefile.am	Sat Jun 16 06:47:45 2001 +0000
     3.2 +++ b/src/video/Makefile.am	Tue Jun 19 13:33:54 2001 +0000
     3.3 @@ -5,7 +5,7 @@
     3.4  
     3.5  # Define which subdirectories need to be built
     3.6  SUBDIRS = @VIDEO_SUBDIRS@
     3.7 -DIST_SUBDIRS = dummy x11 dga nanox fbcon svga ggi aalib \
     3.8 +DIST_SUBDIRS = dummy x11 dga nanox fbcon vgl svga ggi aalib \
     3.9                 wincommon windib windx5 \
    3.10                 maccommon macdsp macrom quartz \
    3.11                 bwindow ps2gs photon cybergfx
     4.1 --- a/src/video/SDL_sysvideo.h	Sat Jun 16 06:47:45 2001 +0000
     4.2 +++ b/src/video/SDL_sysvideo.h	Tue Jun 19 13:33:54 2001 +0000
     4.3 @@ -343,6 +343,9 @@
     4.4  #ifdef ENABLE_GGI
     4.5  extern VideoBootStrap GGI_bootstrap;
     4.6  #endif
     4.7 +#ifdef ENABLE_VGL
     4.8 +extern VideoBootStrap VGL_bootstrap;
     4.9 +#endif
    4.10  #ifdef ENABLE_SVGALIB
    4.11  extern VideoBootStrap SVGALIB_bootstrap;
    4.12  #endif
     5.1 --- a/src/video/SDL_video.c	Sat Jun 16 06:47:45 2001 +0000
     5.2 +++ b/src/video/SDL_video.c	Tue Jun 19 13:33:54 2001 +0000
     5.3 @@ -63,6 +63,9 @@
     5.4  #ifdef ENABLE_GGI
     5.5  	&GGI_bootstrap,
     5.6  #endif
     5.7 +#ifdef ENABLE_VGL
     5.8 +	&VGL_bootstrap,
     5.9 +#endif
    5.10  #ifdef ENABLE_SVGALIB
    5.11  	&SVGALIB_bootstrap,
    5.12  #endif
     6.1 --- a/src/video/svga/SDL_svgaevents.c	Sat Jun 16 06:47:45 2001 +0000
     6.2 +++ b/src/video/svga/SDL_svgaevents.c	Tue Jun 19 13:33:54 2001 +0000
     6.3 @@ -28,6 +28,7 @@
     6.4  /* Handle the event stream, converting X11 events into SDL events */
     6.5  
     6.6  #include <stdio.h>
     6.7 +#include <stdlib.h>
     6.8  
     6.9  #include <vga.h>
    6.10  #include <vgamouse.h>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/video/vgl/Makefile.am	Tue Jun 19 13:33:54 2001 +0000
     7.3 @@ -0,0 +1,15 @@
     7.4 +
     7.5 +## Makefile.am for SDL using the libVGL video driver
     7.6 +
     7.7 +noinst_LTLIBRARIES = libvideo_vgl.la
     7.8 +libvideo_vgl_la_SOURCES = $(VGL_SRCS)
     7.9 +
    7.10 +# The SDL libVGL video driver sources
    7.11 +VGL_SRCS = 			\
    7.12 +	SDL_vglvideo.h		\
    7.13 +	SDL_vglevents.c		\
    7.14 +	SDL_vglevents_c.h	\
    7.15 +	SDL_vglmouse.c		\
    7.16 +	SDL_vglmouse_c.h	\
    7.17 +	SDL_vglvideo.c
    7.18 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/video/vgl/SDL_vglevents.c	Tue Jun 19 13:33:54 2001 +0000
     8.3 @@ -0,0 +1,303 @@
     8.4 +/*
     8.5 +    SDL - Simple DirectMedia Layer
     8.6 +    Copyright (C) 1997, 1998, 1999, 2000  Sam Lantinga
     8.7 +
     8.8 +    This library is free software; you can redistribute it and/or
     8.9 +    modify it under the terms of the GNU Library General Public
    8.10 +    License as published by the Free Software Foundation; either
    8.11 +    version 2 of the License, or (at your option) any later version.
    8.12 +
    8.13 +    This library is distributed in the hope that it will be useful,
    8.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.16 +    Library General Public License for more details.
    8.17 +
    8.18 +    You should have received a copy of the GNU Library General Public
    8.19 +    License along with this library; if not, write to the Free
    8.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    8.21 +
    8.22 +    Sam Lantinga
    8.23 +    slouken@devolution.com
    8.24 +*/
    8.25 +
    8.26 +#ifdef SAVE_RCSID
    8.27 +static char rcsid =
    8.28 + "@(#) $Id$";
    8.29 +#endif
    8.30 +
    8.31 +/* Handle the event stream, converting X11 events into SDL events */
    8.32 +
    8.33 +#include <stdio.h>
    8.34 +
    8.35 +#include <sys/fbio.h>
    8.36 +#include <sys/consio.h>
    8.37 +#include <sys/kbio.h>
    8.38 +#include <vgl.h>
    8.39 +
    8.40 +#include "SDL.h"
    8.41 +#include "SDL_thread.h"
    8.42 +#include "SDL_sysevents.h"
    8.43 +#include "SDL_events_c.h"
    8.44 +#include "SDL_vglvideo.h"
    8.45 +#include "SDL_vglevents_c.h"
    8.46 +
    8.47 +/* The translation tables from a console scancode to a SDL keysym */
    8.48 +/* FIXME: Free the keymap when we shut down the video mode */
    8.49 +static keymap_t *vga_keymap = NULL;
    8.50 +static SDLKey keymap[128];
    8.51 +static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym);
    8.52 +
    8.53 +static int posted = 0;
    8.54 +static int oldx = -1;
    8.55 +static int oldy = -1;
    8.56 +static struct mouse_info mouseinfo;
    8.57 +
    8.58 +/* Ugh, we have to duplicate the kernel's keysym mapping code...
    8.59 +   Oh, it's not so bad. :-)
    8.60 +
    8.61 +   FIXME: Add keyboard LED handling code
    8.62 + */
    8.63 +int VGL_initkeymaps(int fd)
    8.64 +{
    8.65 +	vga_keymap = malloc(sizeof(keymap_t));
    8.66 +	if ( ! vga_keymap ) {
    8.67 +		SDL_OutOfMemory();
    8.68 +		return(-1);
    8.69 +	}
    8.70 +	if (ioctl(fd, GIO_KEYMAP, vga_keymap) == -1) {
    8.71 +		free(vga_keymap);
    8.72 +		vga_keymap = NULL;
    8.73 +		SDL_SetError("Unable to get keyboard map");
    8.74 +		return(-1);
    8.75 +	}
    8.76 +	return(0);
    8.77 +}
    8.78 +
    8.79 +static void handle_keyboard(_THIS)
    8.80 +{
    8.81 +	SDL_keysym keysym;
    8.82 +	int c, pressed, scancode;
    8.83 +
    8.84 +	while ((c = VGLKeyboardGetCh()) != 0) {
    8.85 +		scancode = c & 0x7F;
    8.86 +                if (c & 0x80) {
    8.87 +                        pressed = SDL_RELEASED;
    8.88 +                } else {
    8.89 +                        pressed = SDL_PRESSED;
    8.90 +                }
    8.91 +
    8.92 +		posted += SDL_PrivateKeyboard(pressed,
    8.93 +				 TranslateKey(scancode, &keysym));
    8.94 +	}
    8.95 +}
    8.96 +
    8.97 +int VGL_initmouse(int fd)
    8.98 +{
    8.99 +	mouseinfo.operation = MOUSE_GETINFO;
   8.100 +	if (ioctl(fd, CONS_MOUSECTL, &mouseinfo) != 0)
   8.101 +		return -1;
   8.102 +
   8.103 +	return 0;
   8.104 +}
   8.105 +
   8.106 +static void handle_mouse(_THIS)
   8.107 +{
   8.108 +	char buttons;
   8.109 +	int x, y;
   8.110 +	int button_state, state_changed, state;
   8.111 +	int i;
   8.112 +
   8.113 +	ioctl(0, CONS_MOUSECTL, &mouseinfo);
   8.114 +	x = mouseinfo.u.data.x;
   8.115 +	y = mouseinfo.u.data.y;
   8.116 +	buttons = mouseinfo.u.data.buttons;
   8.117 +
   8.118 +	if ((x != oldx) || (y != oldy)) {
   8.119 +		posted += SDL_PrivateMouseMotion(0, 0, x, y);
   8.120 +		oldx = x;
   8.121 +		oldy = y;
   8.122 +	}
   8.123 +
   8.124 +	/* See what's changed */
   8.125 +	button_state = SDL_GetMouseState(NULL, NULL);
   8.126 +	state_changed = button_state ^ buttons;
   8.127 +	for (i = 0; i < 8; i++) {
   8.128 +		if (state_changed & (1<<i)) {
   8.129 +			if (buttons & (1<<i)) {
   8.130 +				state = SDL_PRESSED;
   8.131 +			} else {
   8.132 +				state = SDL_RELEASED;
   8.133 +			}
   8.134 +			posted += SDL_PrivateMouseButton(state, i + 1, 0, 0);
   8.135 +		}
   8.136 +	}
   8.137 +}
   8.138 +	
   8.139 +
   8.140 +void VGL_PumpEvents(_THIS)
   8.141 +{
   8.142 +	do {
   8.143 +		posted = 0;
   8.144 +		handle_keyboard(this);
   8.145 +		handle_mouse(this);
   8.146 +	} while (posted != 0);
   8.147 +}
   8.148 +
   8.149 +void VGL_InitOSKeymap(_THIS)
   8.150 +{
   8.151 +	int i;
   8.152 +
   8.153 +	/* Initialize the BeOS key translation table */
   8.154 +	for ( i=0; i<SDL_TABLESIZE(keymap); ++i )
   8.155 +		keymap[i] = SDLK_UNKNOWN;
   8.156 +
   8.157 +	keymap[SCANCODE_ESCAPE] = SDLK_ESCAPE;
   8.158 +	keymap[SCANCODE_1] = SDLK_1;
   8.159 +	keymap[SCANCODE_2] = SDLK_2;
   8.160 +	keymap[SCANCODE_3] = SDLK_3;
   8.161 +	keymap[SCANCODE_4] = SDLK_4;
   8.162 +	keymap[SCANCODE_5] = SDLK_5;
   8.163 +	keymap[SCANCODE_6] = SDLK_6;
   8.164 +	keymap[SCANCODE_7] = SDLK_7;
   8.165 +	keymap[SCANCODE_8] = SDLK_8;
   8.166 +	keymap[SCANCODE_9] = SDLK_9;
   8.167 +	keymap[SCANCODE_0] = SDLK_0;
   8.168 +	keymap[SCANCODE_MINUS] = SDLK_MINUS;
   8.169 +	keymap[SCANCODE_EQUAL] = SDLK_EQUALS;
   8.170 +	keymap[SCANCODE_BACKSPACE] = SDLK_BACKSPACE;
   8.171 +	keymap[SCANCODE_TAB] = SDLK_TAB;
   8.172 +	keymap[SCANCODE_Q] = SDLK_q;
   8.173 +	keymap[SCANCODE_W] = SDLK_w;
   8.174 +	keymap[SCANCODE_E] = SDLK_e;
   8.175 +	keymap[SCANCODE_R] = SDLK_r;
   8.176 +	keymap[SCANCODE_T] = SDLK_t;
   8.177 +	keymap[SCANCODE_Y] = SDLK_y;
   8.178 +	keymap[SCANCODE_U] = SDLK_u;
   8.179 +	keymap[SCANCODE_I] = SDLK_i;
   8.180 +	keymap[SCANCODE_O] = SDLK_o;
   8.181 +	keymap[SCANCODE_P] = SDLK_p;
   8.182 +	keymap[SCANCODE_BRACKET_LEFT] = SDLK_LEFTBRACKET;
   8.183 +	keymap[SCANCODE_BRACKET_RIGHT] = SDLK_RIGHTBRACKET;
   8.184 +	keymap[SCANCODE_ENTER] = SDLK_RETURN;
   8.185 +	keymap[SCANCODE_LEFTCONTROL] = SDLK_LCTRL;
   8.186 +	keymap[SCANCODE_A] = SDLK_a;
   8.187 +	keymap[SCANCODE_S] = SDLK_s;
   8.188 +	keymap[SCANCODE_D] = SDLK_d;
   8.189 +	keymap[SCANCODE_F] = SDLK_f;
   8.190 +	keymap[SCANCODE_G] = SDLK_g;
   8.191 +	keymap[SCANCODE_H] = SDLK_h;
   8.192 +	keymap[SCANCODE_J] = SDLK_j;
   8.193 +	keymap[SCANCODE_K] = SDLK_k;
   8.194 +	keymap[SCANCODE_L] = SDLK_l;
   8.195 +	keymap[SCANCODE_SEMICOLON] = SDLK_SEMICOLON;
   8.196 +	keymap[SCANCODE_APOSTROPHE] = SDLK_QUOTE;
   8.197 +	keymap[SCANCODE_GRAVE] = SDLK_BACKQUOTE;
   8.198 +	keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT;
   8.199 +	keymap[SCANCODE_BACKSLASH] = SDLK_BACKSLASH;
   8.200 +	keymap[SCANCODE_Z] = SDLK_z;
   8.201 +	keymap[SCANCODE_X] = SDLK_x;
   8.202 +	keymap[SCANCODE_C] = SDLK_c;
   8.203 +	keymap[SCANCODE_V] = SDLK_v;
   8.204 +	keymap[SCANCODE_B] = SDLK_b;
   8.205 +	keymap[SCANCODE_N] = SDLK_n;
   8.206 +	keymap[SCANCODE_M] = SDLK_m;
   8.207 +	keymap[SCANCODE_COMMA] = SDLK_COMMA;
   8.208 +	keymap[SCANCODE_PERIOD] = SDLK_PERIOD;
   8.209 +	keymap[SCANCODE_SLASH] = SDLK_SLASH;
   8.210 +	keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT;
   8.211 +	keymap[SCANCODE_KEYPADMULTIPLY] = SDLK_KP_MULTIPLY;
   8.212 +	keymap[SCANCODE_LEFTALT] = SDLK_LALT;
   8.213 +	keymap[SCANCODE_SPACE] = SDLK_SPACE;
   8.214 +	keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
   8.215 +	keymap[SCANCODE_F1] = SDLK_F1;
   8.216 +	keymap[SCANCODE_F2] = SDLK_F2;
   8.217 +	keymap[SCANCODE_F3] = SDLK_F3;
   8.218 +	keymap[SCANCODE_F4] = SDLK_F4;
   8.219 +	keymap[SCANCODE_F5] = SDLK_F5;
   8.220 +	keymap[SCANCODE_F6] = SDLK_F6;
   8.221 +	keymap[SCANCODE_F7] = SDLK_F7;
   8.222 +	keymap[SCANCODE_F8] = SDLK_F8;
   8.223 +	keymap[SCANCODE_F9] = SDLK_F9;
   8.224 +	keymap[SCANCODE_F10] = SDLK_F10;
   8.225 +	keymap[SCANCODE_NUMLOCK] = SDLK_NUMLOCK;
   8.226 +	keymap[SCANCODE_SCROLLLOCK] = SDLK_SCROLLOCK;
   8.227 +	keymap[SCANCODE_KEYPAD7] = SDLK_KP7;
   8.228 +	keymap[SCANCODE_CURSORUPLEFT] = SDLK_KP7;
   8.229 +	keymap[SCANCODE_KEYPAD8] = SDLK_KP8;
   8.230 +	keymap[SCANCODE_CURSORUP] = SDLK_KP8;
   8.231 +	keymap[SCANCODE_KEYPAD9] = SDLK_KP9;
   8.232 +	keymap[SCANCODE_CURSORUPRIGHT] = SDLK_KP9;
   8.233 +	keymap[SCANCODE_KEYPADMINUS] = SDLK_KP_MINUS;
   8.234 +	keymap[SCANCODE_KEYPAD4] = SDLK_KP4;
   8.235 +	keymap[SCANCODE_CURSORLEFT] = SDLK_KP4;
   8.236 +	keymap[SCANCODE_KEYPAD5] = SDLK_KP5;
   8.237 +	keymap[SCANCODE_KEYPAD6] = SDLK_KP6;
   8.238 +	keymap[SCANCODE_CURSORRIGHT] = SDLK_KP6;
   8.239 +	keymap[SCANCODE_KEYPADPLUS] = SDLK_KP_PLUS;
   8.240 +	keymap[SCANCODE_KEYPAD1] = SDLK_KP1;
   8.241 +	keymap[SCANCODE_CURSORDOWNLEFT] = SDLK_KP1;
   8.242 +	keymap[SCANCODE_KEYPAD2] = SDLK_KP2;
   8.243 +	keymap[SCANCODE_CURSORDOWN] = SDLK_KP2;
   8.244 +	keymap[SCANCODE_KEYPAD3] = SDLK_KP3;
   8.245 +	keymap[SCANCODE_CURSORDOWNRIGHT] = SDLK_KP3;
   8.246 +	keymap[SCANCODE_KEYPAD0] = SDLK_KP0;
   8.247 +	keymap[SCANCODE_KEYPADPERIOD] = SDLK_KP_PERIOD;
   8.248 +	keymap[SCANCODE_LESS] = SDLK_LESS;
   8.249 +	keymap[SCANCODE_F11] = SDLK_F11;
   8.250 +	keymap[SCANCODE_F12] = SDLK_F12;
   8.251 +	keymap[SCANCODE_KEYPADENTER] = SDLK_KP_ENTER;
   8.252 +	keymap[SCANCODE_RIGHTCONTROL] = SDLK_RCTRL;
   8.253 +	keymap[SCANCODE_CONTROL] = SDLK_RCTRL;
   8.254 +	keymap[SCANCODE_KEYPADDIVIDE] = SDLK_KP_DIVIDE;
   8.255 +	keymap[SCANCODE_PRINTSCREEN] = SDLK_PRINT;
   8.256 +	keymap[SCANCODE_RIGHTALT] = SDLK_RALT;
   8.257 +	keymap[SCANCODE_BREAK] = SDLK_BREAK;
   8.258 +	keymap[SCANCODE_BREAK_ALTERNATIVE] = SDLK_UNKNOWN;
   8.259 +	keymap[SCANCODE_HOME] = SDLK_HOME;
   8.260 +	keymap[SCANCODE_CURSORBLOCKUP] = SDLK_UP;
   8.261 +	keymap[SCANCODE_PAGEUP] = SDLK_PAGEUP;
   8.262 +	keymap[SCANCODE_CURSORBLOCKLEFT] = SDLK_LEFT;
   8.263 +	keymap[SCANCODE_CURSORBLOCKRIGHT] = SDLK_RIGHT;
   8.264 +	keymap[SCANCODE_END] = SDLK_END;
   8.265 +	keymap[SCANCODE_CURSORBLOCKDOWN] = SDLK_DOWN;
   8.266 +	keymap[SCANCODE_PAGEDOWN] = SDLK_PAGEDOWN;
   8.267 +	keymap[SCANCODE_INSERT] = SDLK_INSERT;
   8.268 +	keymap[SCANCODE_REMOVE] = SDLK_DELETE;
   8.269 +	keymap[119] = SDLK_PAUSE;
   8.270 +	keymap[SCANCODE_RIGHTWIN] = SDLK_RSUPER;
   8.271 +	keymap[SCANCODE_LEFTWIN] = SDLK_LSUPER;
   8.272 +	keymap[127] = SDLK_MENU;
   8.273 +}
   8.274 +
   8.275 +static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym)
   8.276 +{
   8.277 +	/* Set the keysym information */
   8.278 +	keysym->scancode = scancode;
   8.279 +	keysym->sym = keymap[scancode];
   8.280 +	keysym->mod = KMOD_NONE;
   8.281 +
   8.282 +	/* If UNICODE is on, get the UNICODE value for the key */
   8.283 +	keysym->unicode = 0;
   8.284 +	if ( SDL_TranslateUNICODE && vga_keymap ) {
   8.285 +		int map;
   8.286 +		SDLMod modstate;
   8.287 +
   8.288 +		modstate = SDL_GetModState();
   8.289 +		map = 0;
   8.290 +		if ( modstate & KMOD_SHIFT ) {
   8.291 +			map += 1;
   8.292 +		}
   8.293 +		if ( modstate & KMOD_CTRL ) {
   8.294 +			map += 2;
   8.295 +		}
   8.296 +		if ( modstate & KMOD_ALT ) {
   8.297 +			map += 4;
   8.298 +		}
   8.299 +		if ( !(vga_keymap->key[scancode].spcl & (0x80 >> map)) ) {
   8.300 +			keysym->unicode = vga_keymap->key[scancode].map[map];
   8.301 +		}
   8.302 +
   8.303 +	}
   8.304 +	return(keysym);
   8.305 +}
   8.306 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/video/vgl/SDL_vglevents_c.h	Tue Jun 19 13:33:54 2001 +0000
     9.3 @@ -0,0 +1,159 @@
     9.4 +/*
     9.5 +    SDL - Simple DirectMedia Layer
     9.6 +    Copyright (C) 1997, 1998, 1999, 2000  Sam Lantinga
     9.7 +
     9.8 +    This library is free software; you can redistribute it and/or
     9.9 +    modify it under the terms of the GNU Library General Public
    9.10 +    License as published by the Free Software Foundation; either
    9.11 +    version 2 of the License, or (at your option) any later version.
    9.12 +
    9.13 +    This library is distributed in the hope that it will be useful,
    9.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.16 +    Library General Public License for more details.
    9.17 +
    9.18 +    You should have received a copy of the GNU Library General Public
    9.19 +    License along with this library; if not, write to the Free
    9.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    9.21 +
    9.22 +    Sam Lantinga
    9.23 +    slouken@devolution.com
    9.24 +*/
    9.25 +
    9.26 +#ifdef SAVE_RCSID
    9.27 +static char rcsid =
    9.28 + "@(#) $Id$";
    9.29 +#endif
    9.30 +
    9.31 +#include "SDL_vglvideo.h"
    9.32 +
    9.33 +/* Variables and functions exported by SDL_sysevents.c to other parts 
    9.34 +   of the native video subsystem (SDL_sysvideo.c)
    9.35 +*/
    9.36 +extern int VGL_initkeymaps(int fd);
    9.37 +extern int VGL_initmouse(int fd);
    9.38 +extern void VGL_keyboardcallback(int scancode, int pressed);
    9.39 +
    9.40 +extern void VGL_InitOSKeymap(_THIS);
    9.41 +extern void VGL_PumpEvents(_THIS);
    9.42 +
    9.43 +/* Mouse buttons */
    9.44 +#define MOUSE_LEFTBUTTON        0x01
    9.45 +#define MOUSE_MIDDLEBUTTON      0x02
    9.46 +#define MOUSE_RIGHTBUTTON       0x04
    9.47 +
    9.48 +/* Scancodes */
    9.49 +#define SCANCODE_ESCAPE			1
    9.50 +#define SCANCODE_1			2
    9.51 +#define SCANCODE_2			3
    9.52 +#define SCANCODE_3			4
    9.53 +#define SCANCODE_4			5
    9.54 +#define SCANCODE_5			6
    9.55 +#define SCANCODE_6			7
    9.56 +#define SCANCODE_7			8
    9.57 +#define SCANCODE_8			9
    9.58 +#define SCANCODE_9			10
    9.59 +#define SCANCODE_0			11
    9.60 +#define SCANCODE_MINUS			12
    9.61 +#define SCANCODE_EQUAL			13
    9.62 +#define SCANCODE_BACKSPACE		14
    9.63 +#define SCANCODE_TAB			15
    9.64 +#define SCANCODE_Q			16
    9.65 +#define SCANCODE_W			17
    9.66 +#define SCANCODE_E			18
    9.67 +#define SCANCODE_R			19
    9.68 +#define SCANCODE_T			20
    9.69 +#define SCANCODE_Y			21
    9.70 +#define SCANCODE_U			22
    9.71 +#define SCANCODE_I			23
    9.72 +#define SCANCODE_O			24
    9.73 +#define SCANCODE_P			25
    9.74 +#define SCANCODE_BRACKET_LEFT		26
    9.75 +#define SCANCODE_BRACKET_RIGHT		27
    9.76 +#define SCANCODE_ENTER			28
    9.77 +#define SCANCODE_LEFTCONTROL		29
    9.78 +#define SCANCODE_A			30
    9.79 +#define SCANCODE_S			31
    9.80 +#define SCANCODE_D			32
    9.81 +#define SCANCODE_F			33
    9.82 +#define SCANCODE_G			34
    9.83 +#define SCANCODE_H			35
    9.84 +#define SCANCODE_J			36
    9.85 +#define SCANCODE_K			37
    9.86 +#define SCANCODE_L			38
    9.87 +#define SCANCODE_SEMICOLON		39
    9.88 +#define SCANCODE_APOSTROPHE		40
    9.89 +#define SCANCODE_GRAVE			41
    9.90 +#define SCANCODE_LEFTSHIFT		42
    9.91 +#define SCANCODE_BACKSLASH		43
    9.92 +#define SCANCODE_Z			44
    9.93 +#define SCANCODE_X			45
    9.94 +#define SCANCODE_C			46
    9.95 +#define SCANCODE_V			47
    9.96 +#define SCANCODE_B			48
    9.97 +#define SCANCODE_N			49
    9.98 +#define SCANCODE_M			50
    9.99 +#define SCANCODE_COMMA			51
   9.100 +#define SCANCODE_PERIOD			52
   9.101 +#define SCANCODE_SLASH			53
   9.102 +#define SCANCODE_RIGHTSHIFT		54
   9.103 +#define SCANCODE_KEYPADMULTIPLY		55
   9.104 +#define SCANCODE_LEFTALT		56
   9.105 +#define SCANCODE_SPACE			57
   9.106 +#define SCANCODE_CAPSLOCK		58
   9.107 +#define SCANCODE_F1			59
   9.108 +#define SCANCODE_F2			60
   9.109 +#define SCANCODE_F3			61
   9.110 +#define SCANCODE_F4			62
   9.111 +#define SCANCODE_F5			63
   9.112 +#define SCANCODE_F6			64
   9.113 +#define SCANCODE_F7			65
   9.114 +#define SCANCODE_F8			66
   9.115 +#define SCANCODE_F9			67
   9.116 +#define SCANCODE_F10			68
   9.117 +#define SCANCODE_NUMLOCK		69
   9.118 +#define SCANCODE_SCROLLLOCK		70
   9.119 +#define SCANCODE_KEYPAD7		71
   9.120 +#define SCANCODE_CURSORUPLEFT		71
   9.121 +#define SCANCODE_KEYPAD8		72
   9.122 +#define SCANCODE_CURSORUP		72
   9.123 +#define SCANCODE_KEYPAD9		73
   9.124 +#define SCANCODE_CURSORUPRIGHT		73
   9.125 +#define SCANCODE_KEYPADMINUS		74
   9.126 +#define SCANCODE_KEYPAD4		75
   9.127 +#define SCANCODE_CURSORLEFT		75
   9.128 +#define SCANCODE_KEYPAD5		76
   9.129 +#define SCANCODE_KEYPAD6		77
   9.130 +#define SCANCODE_CURSORRIGHT		77
   9.131 +#define SCANCODE_KEYPADPLUS		78
   9.132 +#define SCANCODE_KEYPAD1		79
   9.133 +#define SCANCODE_CURSORDOWNLEFT		79
   9.134 +#define SCANCODE_KEYPAD2		80
   9.135 +#define SCANCODE_CURSORDOWN		80
   9.136 +#define SCANCODE_KEYPAD3		81
   9.137 +#define SCANCODE_CURSORDOWNRIGHT	81
   9.138 +#define SCANCODE_KEYPAD0		82
   9.139 +#define SCANCODE_KEYPADPERIOD		83
   9.140 +#define SCANCODE_LESS			86
   9.141 +#define SCANCODE_F11			87
   9.142 +#define SCANCODE_F12			88
   9.143 +#define SCANCODE_KEYPADENTER		89
   9.144 +#define SCANCODE_RIGHTCONTROL		90
   9.145 +#define SCANCODE_CONTROL		107
   9.146 +#define SCANCODE_KEYPADDIVIDE		91
   9.147 +#define SCANCODE_PRINTSCREEN		92
   9.148 +#define SCANCODE_RIGHTALT		93
   9.149 +#define SCANCODE_BREAK			104	/* Beware: is 119     */
   9.150 +#define SCANCODE_BREAK_ALTERNATIVE	104	/* on some keyboards! */
   9.151 +#define SCANCODE_HOME			94
   9.152 +#define SCANCODE_CURSORBLOCKUP		95	/* Cursor key block */
   9.153 +#define SCANCODE_PAGEUP			96
   9.154 +#define SCANCODE_CURSORBLOCKLEFT	97	/* Cursor key block */
   9.155 +#define SCANCODE_CURSORBLOCKRIGHT	98	/* Cursor key block */
   9.156 +#define SCANCODE_END			99
   9.157 +#define SCANCODE_CURSORBLOCKDOWN	100	/* Cursor key block */
   9.158 +#define SCANCODE_PAGEDOWN		101
   9.159 +#define SCANCODE_INSERT			102
   9.160 +#define SCANCODE_REMOVE			103
   9.161 +#define SCANCODE_RIGHTWIN		106
   9.162 +#define SCANCODE_LEFTWIN		105
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/src/video/vgl/SDL_vglmouse.c	Tue Jun 19 13:33:54 2001 +0000
    10.3 @@ -0,0 +1,66 @@
    10.4 +/*
    10.5 +    SDL - Simple DirectMedia Layer
    10.6 +    Copyright (C) 1997, 1998, 1999, 2000  Sam Lantinga
    10.7 +
    10.8 +    This library is free software; you can redistribute it and/or
    10.9 +    modify it under the terms of the GNU Library General Public
   10.10 +    License as published by the Free Software Foundation; either
   10.11 +    version 2 of the License, or (at your option) any later version.
   10.12 +
   10.13 +    This library is distributed in the hope that it will be useful,
   10.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   10.16 +    Library General Public License for more details.
   10.17 +
   10.18 +    You should have received a copy of the GNU Library General Public
   10.19 +    License along with this library; if not, write to the Free
   10.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   10.21 +
   10.22 +    Sam Lantinga
   10.23 +    slouken@devolution.com
   10.24 +*/
   10.25 +
   10.26 +#ifdef SAVE_RCSID
   10.27 +static char rcsid =
   10.28 + "@(#) $Id$";
   10.29 +#endif
   10.30 +
   10.31 +#include <stdio.h>
   10.32 +
   10.33 +#include "SDL_error.h"
   10.34 +#include "SDL_mouse.h"
   10.35 +#include "SDL_events_c.h"
   10.36 +#include "SDL_vglvideo.h"
   10.37 +#include "SDL_vglmouse_c.h"
   10.38 +
   10.39 +
   10.40 +/* The implementation dependent data for the window manager cursor */
   10.41 +struct WMcursor {
   10.42 +	int unused;
   10.43 +};
   10.44 +
   10.45 +
   10.46 +void VGL_FreeWMCursor(_THIS, WMcursor *cursor)
   10.47 +{
   10.48 +	return;
   10.49 +}
   10.50 +
   10.51 +WMcursor *VGL_CreateWMCursor(_THIS,
   10.52 +		Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
   10.53 +{
   10.54 +	return(NULL);
   10.55 +}
   10.56 +
   10.57 +int VGL_ShowWMCursor(_THIS, WMcursor *cursor)
   10.58 +{
   10.59 +	return(0);
   10.60 +}
   10.61 +
   10.62 +void VGL_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
   10.63 +{
   10.64 +	x += (this->screen->offset % this->screen->pitch) /
   10.65 +	      this->screen->format->BytesPerPixel;
   10.66 +	y += (this->screen->offset / this->screen->pitch);
   10.67 +	SDL_PrivateMouseMotion(0, 0, x, y);
   10.68 +}
   10.69 +
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/src/video/vgl/SDL_vglmouse_c.h	Tue Jun 19 13:33:54 2001 +0000
    11.3 @@ -0,0 +1,36 @@
    11.4 +/*
    11.5 +    SDL - Simple DirectMedia Layer
    11.6 +    Copyright (C) 1997, 1998, 1999, 2000  Sam Lantinga
    11.7 +
    11.8 +    This library is free software; you can redistribute it and/or
    11.9 +    modify it under the terms of the GNU Library General Public
   11.10 +    License as published by the Free Software Foundation; either
   11.11 +    version 2 of the License, or (at your option) any later version.
   11.12 +
   11.13 +    This library is distributed in the hope that it will be useful,
   11.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11.16 +    Library General Public License for more details.
   11.17 +
   11.18 +    You should have received a copy of the GNU Library General Public
   11.19 +    License along with this library; if not, write to the Free
   11.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   11.21 +
   11.22 +    Sam Lantinga
   11.23 +    slouken@devolution.com
   11.24 +*/
   11.25 +
   11.26 +#ifdef SAVE_RCSID
   11.27 +static char rcsid =
   11.28 + "@(#) $Id$";
   11.29 +#endif
   11.30 +
   11.31 +#include "SDL_vglvideo.h"
   11.32 +
   11.33 +/* Functions to be exported */
   11.34 +extern void VGL_FreeWMCursor(_THIS, WMcursor *cursor);
   11.35 +extern WMcursor *VGL_CreateWMCursor(_THIS,
   11.36 +		Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
   11.37 +extern int VGL_ShowWMCursor(_THIS, WMcursor *cursor);
   11.38 +extern void VGL_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
   11.39 +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/video/vgl/SDL_vglvideo.c	Tue Jun 19 13:33:54 2001 +0000
    12.3 @@ -0,0 +1,642 @@
    12.4 +/*
    12.5 +    SDL - Simple DirectMedia Layer
    12.6 +    Copyright (C) 1997, 1998, 1999, 2000  Sam Lantinga
    12.7 +
    12.8 +    This library is free software; you can redistribute it and/or
    12.9 +    modify it under the terms of the GNU Library General Public
   12.10 +    License as published by the Free Software Foundation; either
   12.11 +    version 2 of the License, or (at your option) any later version.
   12.12 +
   12.13 +    This library is distributed in the hope that it will be useful,
   12.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12.16 +    Library General Public License for more details.
   12.17 +
   12.18 +    You should have received a copy of the GNU Library General Public
   12.19 +    License along with this library; if not, write to the Free
   12.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   12.21 +
   12.22 +    Sam Lantinga
   12.23 +    slouken@devolution.com
   12.24 +*/
   12.25 +
   12.26 +#ifdef SAVE_RCSID
   12.27 +static char rcsid =
   12.28 + "@(#) $Id$";
   12.29 +#endif
   12.30 +
   12.31 +/* libvga based SDL video driver implementation.
   12.32 +*/
   12.33 +
   12.34 +#include <err.h>
   12.35 +#include <osreldate.h>
   12.36 +#include <stdlib.h>
   12.37 +#include <stdio.h>
   12.38 +#include <unistd.h>
   12.39 +#include <sys/stat.h>
   12.40 +
   12.41 +#include <sys/fbio.h>
   12.42 +#include <sys/consio.h>
   12.43 +#include <sys/kbio.h>
   12.44 +#include <vgl.h>
   12.45 +
   12.46 +#include "SDL.h"
   12.47 +#include "SDL_error.h"
   12.48 +#include "SDL_video.h"
   12.49 +#include "SDL_mouse.h"
   12.50 +#include "SDL_sysvideo.h"
   12.51 +#include "SDL_pixels_c.h"
   12.52 +#include "SDL_events_c.h"
   12.53 +#include "SDL_vglvideo.h"
   12.54 +#include "SDL_vglevents_c.h"
   12.55 +#include "SDL_vglmouse_c.h"
   12.56 +
   12.57 +
   12.58 +/* Initialization/Query functions */
   12.59 +static int VGL_VideoInit(_THIS, SDL_PixelFormat *vformat);
   12.60 +static SDL_Rect **VGL_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
   12.61 +static SDL_Surface *VGL_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
   12.62 +static int VGL_SetColors(_THIS, int firstcolor, int ncolors,
   12.63 +			  SDL_Color *colors);
   12.64 +static void VGL_VideoQuit(_THIS);
   12.65 +
   12.66 +/* Hardware surface functions */
   12.67 +static int VGL_AllocHWSurface(_THIS, SDL_Surface *surface);
   12.68 +static int VGL_LockHWSurface(_THIS, SDL_Surface *surface);
   12.69 +static int VGL_FlipHWSurface(_THIS, SDL_Surface *surface);
   12.70 +static void VGL_UnlockHWSurface(_THIS, SDL_Surface *surface);
   12.71 +static void VGL_FreeHWSurface(_THIS, SDL_Surface *surface);
   12.72 +
   12.73 +/* Misc function */
   12.74 +static VGLMode ** VGLListModes(int depth, int mem_model);
   12.75 +static void VGLWaitRetrace(void);
   12.76 +
   12.77 +/* VGL driver bootstrap functions */
   12.78 +
   12.79 +static int VGL_Available(void)
   12.80 +{
   12.81 +	/*
   12.82 +	 * Check to see if we are root and stdin is a
   12.83 +	 * virtual console. Also try to ensure that
   12.84 +	 * modes other than 320x200 are available
   12.85 +	 */
   12.86 +	int console, hires_available, i;
   12.87 +	VGLMode **modes;
   12.88 +
   12.89 +	console = STDIN_FILENO;
   12.90 +	if ( console >= 0 ) {
   12.91 +		struct stat sb;
   12.92 +		struct vt_mode dummy;
   12.93 +
   12.94 +		if ( (fstat(console, &sb) < 0) ||
   12.95 +		     (ioctl(console, VT_GETMODE, &dummy) < 0) ) {
   12.96 +			console = -1;
   12.97 +		}
   12.98 +	}
   12.99 +	if (geteuid() != 0 && console == -1)
  12.100 +		return 0;
  12.101 +
  12.102 +	modes = VGLListModes(8, V_INFO_MM_DIRECT | V_INFO_MM_PACKED);
  12.103 +	hires_available = 0;
  12.104 +	for (i = 0; modes[i] != NULL; i++) {
  12.105 +		if ((modes[i]->ModeInfo.Xsize > 320) &&
  12.106 +		    (modes[i]->ModeInfo.Ysize > 200) &&
  12.107 +		    ((modes[i]->ModeInfo.Type == VIDBUF8) ||
  12.108 +		     (modes[i]->ModeInfo.Type == VIDBUF16) ||
  12.109 +		     (modes[i]->ModeInfo.Type == VIDBUF32))) {
  12.110 +			hires_available = 1;
  12.111 +			break;
  12.112 +		}
  12.113 +	}
  12.114 +	return hires_available;
  12.115 +}
  12.116 +
  12.117 +static void VGL_DeleteDevice(SDL_VideoDevice *device)
  12.118 +{
  12.119 +	free(device->hidden);
  12.120 +	free(device);
  12.121 +}
  12.122 +
  12.123 +static SDL_VideoDevice *VGL_CreateDevice(int devindex)
  12.124 +{
  12.125 +	SDL_VideoDevice *device;
  12.126 +
  12.127 +	/* Initialize all variables that we clean on shutdown */
  12.128 +	device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice));
  12.129 +	if ( device ) {
  12.130 +		memset(device, 0, (sizeof *device));
  12.131 +		device->hidden = (struct SDL_PrivateVideoData *)
  12.132 +				  malloc((sizeof *device->hidden));
  12.133 +	}
  12.134 +	if ( (device == NULL) || (device->hidden == NULL) ) {
  12.135 +		SDL_OutOfMemory();
  12.136 +		if ( device ) {
  12.137 +			free(device);
  12.138 +		}
  12.139 +		return(0);
  12.140 +	}
  12.141 +	memset(device->hidden, 0, (sizeof *device->hidden));
  12.142 +
  12.143 +	/* Set the function pointers */
  12.144 +	device->VideoInit = VGL_VideoInit;
  12.145 +	device->ListModes = VGL_ListModes;
  12.146 +	device->SetVideoMode = VGL_SetVideoMode;
  12.147 +	device->SetColors = VGL_SetColors;
  12.148 +	device->UpdateRects = NULL;
  12.149 +	device->VideoQuit = VGL_VideoQuit;
  12.150 +	device->AllocHWSurface = VGL_AllocHWSurface;
  12.151 +	device->CheckHWBlit = NULL;
  12.152 +	device->FillHWRect = NULL;
  12.153 +	device->SetHWColorKey = NULL;
  12.154 +	device->SetHWAlpha = NULL;
  12.155 +	device->LockHWSurface = VGL_LockHWSurface;
  12.156 +	device->UnlockHWSurface = VGL_UnlockHWSurface;
  12.157 +	device->FlipHWSurface = VGL_FlipHWSurface;
  12.158 +	device->FreeHWSurface = VGL_FreeHWSurface;
  12.159 +	device->SetIcon = NULL;
  12.160 +	device->SetCaption = NULL;
  12.161 +	device->GetWMInfo = NULL;
  12.162 +	device->FreeWMCursor = VGL_FreeWMCursor;
  12.163 +	device->CreateWMCursor = VGL_CreateWMCursor;
  12.164 +	device->ShowWMCursor = VGL_ShowWMCursor;
  12.165 +	device->WarpWMCursor = VGL_WarpWMCursor;
  12.166 +	device->InitOSKeymap = VGL_InitOSKeymap;
  12.167 +	device->PumpEvents = VGL_PumpEvents;
  12.168 +
  12.169 +	device->free = VGL_DeleteDevice;
  12.170 +
  12.171 +	return device;
  12.172 +}
  12.173 +
  12.174 +VideoBootStrap VGL_bootstrap = {
  12.175 +	"vgl", "FreeBSD libVGL",
  12.176 +	VGL_Available, VGL_CreateDevice
  12.177 +};
  12.178 +
  12.179 +static int VGL_AddMode(_THIS, VGLMode *inmode)
  12.180 +{
  12.181 +	SDL_Rect *mode;
  12.182 +
  12.183 +	int i, index;
  12.184 +	int next_mode;
  12.185 +
  12.186 +	/* Check to see if we already have this mode */
  12.187 +	if (inmode->Depth < 8) {  /* Not supported */
  12.188 +		return 0;
  12.189 +	}
  12.190 +	index = ((inmode->Depth + 7) / 8) - 1;
  12.191 +	for (i=0; i<SDL_nummodes[index]; ++i) {
  12.192 +		mode = SDL_modelist[index][i];
  12.193 +		if ((mode->w == inmode->ModeInfo.Xsize) &&
  12.194 +		    (mode->h == inmode->ModeInfo.Ysize))
  12.195 +			return 0;
  12.196 +	}
  12.197 +
  12.198 +	/* Set up the new video mode rectangle */
  12.199 +	mode = (SDL_Rect *)malloc(sizeof *mode);
  12.200 +	if (mode == NULL) {
  12.201 +		SDL_OutOfMemory();
  12.202 +		return -1;
  12.203 +	}
  12.204 +	mode->x = 0;
  12.205 +	mode->y = 0;
  12.206 +	mode->w = inmode->ModeInfo.Xsize;
  12.207 +	mode->h = inmode->ModeInfo.Ysize;
  12.208 +
  12.209 +	/* Allocate the new list of modes, and fill in the new mode */
  12.210 +	next_mode = SDL_nummodes[index];
  12.211 +	SDL_modelist[index] = (SDL_Rect **)
  12.212 +		realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
  12.213 +	if (SDL_modelist[index] == NULL) {
  12.214 +		SDL_OutOfMemory();
  12.215 +		SDL_nummodes[index] = 0;
  12.216 +		free(mode);
  12.217 +		return -1;
  12.218 +	}
  12.219 +	SDL_modelist[index][next_mode] = mode;
  12.220 +	SDL_modelist[index][next_mode+1] = NULL;
  12.221 +	SDL_nummodes[index]++;
  12.222 +
  12.223 +	return 0;
  12.224 +}
  12.225 +
  12.226 +static void VGL_UpdateVideoInfo(_THIS)
  12.227 +{
  12.228 +	this->info.wm_available = 0;
  12.229 +	this->info.hw_available = 1;
  12.230 +	this->info.video_mem = 0;
  12.231 +	if (VGLCurMode == NULL) {
  12.232 +		return;
  12.233 +	}
  12.234 +	if (VGLCurMode->ModeInfo.PixelBytes > 0) {
  12.235 +		this->info.video_mem = VGLCurMode->ModeInfo.PixelBytes *
  12.236 +				       VGLCurMode->ModeInfo.Xsize *
  12.237 +				       VGLCurMode->ModeInfo.Ysize;
  12.238 +	}
  12.239 +}
  12.240 +
  12.241 +int VGL_VideoInit(_THIS, SDL_PixelFormat *vformat)
  12.242 +{
  12.243 +	int i;
  12.244 +	int total_modes;
  12.245 +	VGLMode **modes;
  12.246 +
  12.247 +	/* Initialize all variables that we clean on shutdown */
  12.248 +	for ( i=0; i<NUM_MODELISTS; ++i ) {
  12.249 +		SDL_nummodes[i] = 0;
  12.250 +		SDL_modelist[i] = NULL;
  12.251 +	}
  12.252 +
  12.253 +	/* Enable mouse and keyboard support */
  12.254 +	if (getenv("SDL_NO_RAWKBD") == NULL) {
  12.255 +		if (VGLKeyboardInit(VGL_CODEKEYS) != 0) {
  12.256 +			SDL_SetError("Unable to initialize keyboard");
  12.257 +			return -1;
  12.258 +		}
  12.259 +	} else {
  12.260 +		warnx("Requiest to put keyboard into a raw mode ignored");
  12.261 +	}
  12.262 +	if (VGL_initkeymaps(STDIN_FILENO) != 0) {
  12.263 +		SDL_SetError("Unable to initialize keymap");
  12.264 +		return -1;
  12.265 +	}
  12.266 +	if (VGL_initmouse(STDIN_FILENO) != 0) {
  12.267 +		SDL_SetError("Unable to initialize mouse");
  12.268 +		return -1;
  12.269 +	}
  12.270 +
  12.271 +	/* Determine the screen depth */
  12.272 +	if (VGLCurMode != NULL)
  12.273 +		vformat->BitsPerPixel = VGLCurMode->Depth;
  12.274 +	else
  12.275 +		vformat->BitsPerPixel = 16;	/* Good default */
  12.276 +
  12.277 +	/* Query for the list of available video modes */
  12.278 +	total_modes = 0;
  12.279 +	modes = VGLListModes(-1, V_INFO_MM_DIRECT | V_INFO_MM_PACKED);
  12.280 +	for (i = 0; modes[i] != NULL; i++) {
  12.281 +		if ((modes[i]->ModeInfo.Type == VIDBUF8) ||
  12.282 +		    (modes[i]->ModeInfo.Type == VIDBUF16) ||
  12.283 +		    (modes[i]->ModeInfo.Type == VIDBUF32)) {
  12.284 +			VGL_AddMode(this, modes[i]);
  12.285 +			total_modes++;
  12.286 +		}
  12.287 +	}
  12.288 +	if (total_modes == 0) {
  12.289 +		SDL_SetError("No linear video modes available");
  12.290 +		return -1;
  12.291 +	}
  12.292 +
  12.293 +	/* Fill in our hardware acceleration capabilities */
  12.294 +	VGL_UpdateVideoInfo(this);
  12.295 +
  12.296 +	/* Create the hardware surface lock mutex */
  12.297 +	hw_lock = SDL_CreateMutex();
  12.298 +	if (hw_lock == NULL) {
  12.299 +		SDL_SetError("Unable to create lock mutex");
  12.300 +		VGL_VideoQuit(this);
  12.301 +		return -1;
  12.302 +	}
  12.303 +
  12.304 +	/* We're done! */
  12.305 +	return 0;
  12.306 +}
  12.307 +
  12.308 +SDL_Rect **VGL_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
  12.309 +{
  12.310 +	return SDL_modelist[((format->BitsPerPixel+7)/8)-1];
  12.311 +}
  12.312 +
  12.313 +/* Various screen update functions available */
  12.314 +static void VGL_DirectUpdate(_THIS, int numrects, SDL_Rect *rects);
  12.315 +static void VGL_BankedUpdate(_THIS, int numrects, SDL_Rect *rects);
  12.316 +
  12.317 +SDL_Surface *VGL_SetVideoMode(_THIS, SDL_Surface *current,
  12.318 +			      int width, int height, int bpp, Uint32 flags)
  12.319 +{
  12.320 +	int mode_found;
  12.321 +	int i;
  12.322 +	VGLMode **modes;
  12.323 +
  12.324 +	modes = VGLListModes(bpp, V_INFO_MM_DIRECT | V_INFO_MM_PACKED);
  12.325 +	mode_found = 0;
  12.326 +	for (i = 0; modes[i] != NULL; i++) {
  12.327 +		if ((modes[i]->ModeInfo.Xsize == width) &&
  12.328 +		    (modes[i]->ModeInfo.Ysize == height) &&
  12.329 +		    ((modes[i]->ModeInfo.Type == VIDBUF8) ||
  12.330 +		     (modes[i]->ModeInfo.Type == VIDBUF16) ||
  12.331 +		     (modes[i]->ModeInfo.Type == VIDBUF32))) {
  12.332 +			mode_found = 1;
  12.333 +			break;
  12.334 +		}
  12.335 +	}
  12.336 +	if (mode_found == 0) {
  12.337 +		SDL_SetError("No matching video mode found");
  12.338 +		return NULL;
  12.339 +	}
  12.340 +
  12.341 +	/* Shutdown previous videomode (if any) */
  12.342 +	if (VGLCurMode != NULL)
  12.343 +		VGLEnd();
  12.344 +
  12.345 +	/* Try to set the requested linear video mode */
  12.346 +	if (VGLInit(modes[i]->ModeId) != 0) {
  12.347 +		SDL_SetError("Unable to switch to requested mode");
  12.348 +		return NULL;
  12.349 +	}
  12.350 +
  12.351 +	VGLCurMode = realloc(VGLCurMode, sizeof(VGLMode));
  12.352 +	VGLCurMode->ModeInfo = *VGLDisplay;
  12.353 +	VGLCurMode->Depth = modes[i]->Depth;
  12.354 +	VGLCurMode->ModeId = modes[i]->ModeId;
  12.355 +	VGLCurMode->Rmask = modes[i]->Rmask;
  12.356 +	VGLCurMode->Gmask = modes[i]->Gmask;
  12.357 +	VGLCurMode->Bmask = modes[i]->Bmask;
  12.358 +
  12.359 +	/* Workaround a bug in libvgl */
  12.360 +	if (VGLCurMode->ModeInfo.PixelBytes == 0)
  12.361 +		(VGLCurMode->ModeInfo.PixelBytes = 1);
  12.362 +
  12.363 +	current->w = VGLCurMode->ModeInfo.Xsize;
  12.364 +	current->h = VGLCurMode->ModeInfo.Ysize;
  12.365 +	current->pixels = VGLCurMode->ModeInfo.Bitmap;
  12.366 +	current->pitch = VGLCurMode->ModeInfo.Xsize *
  12.367 +			 VGLCurMode->ModeInfo.PixelBytes;
  12.368 +	current->flags = (SDL_FULLSCREEN | SDL_HWSURFACE);
  12.369 +
  12.370 +	/* Check if we are in a pseudo-color mode */
  12.371 +	if (VGLCurMode->ModeInfo.Type == VIDBUF8)
  12.372 +		current->flags |= SDL_HWPALETTE;
  12.373 +
  12.374 +	/* Check if we can do doublebuffering */
  12.375 +	if (flags & SDL_DOUBLEBUF) {
  12.376 +		if (VGLCurMode->ModeInfo.Xsize * 2 <=
  12.377 +		    VGLCurMode->ModeInfo.VYsize) {
  12.378 +			current->flags |= SDL_DOUBLEBUF;
  12.379 +			flip_page = 0;
  12.380 +			flip_address[0] = (byte *)current->pixels;
  12.381 +			flip_address[1] = (byte *)current->pixels +
  12.382 +					  current->h * current->pitch;
  12.383 +			VGL_FlipHWSurface(this, current);
  12.384 +		}
  12.385 +	}
  12.386 +
  12.387 +	if (! SDL_ReallocFormat(current, modes[i]->Depth, VGLCurMode->Rmask,
  12.388 +				VGLCurMode->Gmask, VGLCurMode->Bmask, 0)) {
  12.389 +		return NULL;
  12.390 +	}
  12.391 +
  12.392 +	/* Update hardware acceleration info */
  12.393 +	VGL_UpdateVideoInfo(this);
  12.394 +
  12.395 +	/* Set the blit function */
  12.396 +	this->UpdateRects = VGL_DirectUpdate;
  12.397 +
  12.398 +	/* We're done */
  12.399 +	return current;
  12.400 +}
  12.401 +
  12.402 +/* We don't actually allow hardware surfaces other than the main one */
  12.403 +static int VGL_AllocHWSurface(_THIS, SDL_Surface *surface)
  12.404 +{
  12.405 +	return -1;
  12.406 +}
  12.407 +static void VGL_FreeHWSurface(_THIS, SDL_Surface *surface)
  12.408 +{
  12.409 +	return;
  12.410 +}
  12.411 +
  12.412 +/* We need to wait for vertical retrace on page flipped displays */
  12.413 +static int VGL_LockHWSurface(_THIS, SDL_Surface *surface)
  12.414 +{
  12.415 +	if (surface == SDL_VideoSurface) {
  12.416 +		SDL_mutexP(hw_lock);
  12.417 +	}
  12.418 +	return 0;
  12.419 +}
  12.420 +static void VGL_UnlockHWSurface(_THIS, SDL_Surface *surface)
  12.421 +{
  12.422 +	if (surface == SDL_VideoSurface) {
  12.423 +		SDL_mutexV(hw_lock);
  12.424 +	}
  12.425 +}
  12.426 +
  12.427 +static int VGL_FlipHWSurface(_THIS, SDL_Surface *surface)
  12.428 +{
  12.429 +//	VGLWaitRetrace();
  12.430 +	if (VGLPanScreen(VGLDisplay, 0, flip_page * surface->h) < 0) {
  12.431 +		SDL_SetError("VGLPanSreen() failed");
  12.432 +                return -1;
  12.433 +        }
  12.434 +
  12.435 +	flip_page = !flip_page;
  12.436 +	surface->pixels = flip_address[flip_page];
  12.437 +
  12.438 +	return 0;
  12.439 +}
  12.440 +
  12.441 +static void VGL_DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
  12.442 +{
  12.443 +	return;
  12.444 +}
  12.445 +
  12.446 +static void VGL_BankedUpdate(_THIS, int numrects, SDL_Rect *rects)
  12.447 +{
  12.448 +	return;
  12.449 +}
  12.450 +
  12.451 +int VGL_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
  12.452 +{
  12.453 +        int i;
  12.454 +
  12.455 +	for(i = 0; i < ncolors; i++) {
  12.456 +	        VGLSetPaletteIndex(firstcolor + i,
  12.457 +			       colors[i].r>>2,
  12.458 +			       colors[i].g>>2,
  12.459 +			       colors[i].b>>2);
  12.460 +	}
  12.461 +	return 1;
  12.462 +}
  12.463 +
  12.464 +/* Note:  If we are terminated, this could be called in the middle of
  12.465 +   another SDL video routine -- notably UpdateRects.
  12.466 +*/
  12.467 +void VGL_VideoQuit(_THIS)
  12.468 +{
  12.469 +	int i, j;
  12.470 +
  12.471 +	/* Return the keyboard to the normal state */
  12.472 +	VGLKeyboardEnd();
  12.473 +
  12.474 +	/* Reset the console video mode if we actually initialised one */
  12.475 +	if (VGLCurMode != NULL) {
  12.476 +		VGLEnd();
  12.477 +		free(VGLCurMode);
  12.478 +		VGLCurMode = NULL;
  12.479 +	}
  12.480 +
  12.481 +	/* Clear the lock mutex */
  12.482 +	if (hw_lock != NULL) {
  12.483 +		SDL_DestroyMutex(hw_lock);
  12.484 +		hw_lock = NULL;
  12.485 +	}
  12.486 +
  12.487 +	/* Free video mode lists */
  12.488 +	for (i = 0; i < NUM_MODELISTS; i++) {
  12.489 +		if (SDL_modelist[i] != NULL) {
  12.490 +			for (j = 0; SDL_modelist[i][j] != NULL; ++j) {
  12.491 +				free(SDL_modelist[i][j]);
  12.492 +			}
  12.493 +			free(SDL_modelist[i]);
  12.494 +			SDL_modelist[i] = NULL;
  12.495 +		}
  12.496 +	}
  12.497 +
  12.498 +	if ( this->screen && (this->screen->flags & SDL_HWSURFACE) ) {
  12.499 +	/* Direct screen access, not a memory buffer */
  12.500 +		this->screen->pixels = NULL;
  12.501 +	}
  12.502 +}
  12.503 +
  12.504 +#define VGL_RED_INDEX	0
  12.505 +#define VGL_GREEN_INDEX	1
  12.506 +#define VGL_BLUE_INDEX	2
  12.507 +
  12.508 +static VGLMode **
  12.509 +VGLListModes(int depth, int mem_model)
  12.510 +{
  12.511 +  static VGLMode **modes = NULL;
  12.512 +
  12.513 +  VGLBitmap *vminfop;
  12.514 +  VGLMode **modesp, *modescp;
  12.515 +  video_info_t minfo;
  12.516 +  int adptype, i, modenum;
  12.517 +
  12.518 +  if (modes == NULL) {
  12.519 +    modes = malloc(sizeof(VGLMode *) * M_VESA_MODE_MAX);
  12.520 +    bzero(modes, sizeof(VGLMode *) * M_VESA_MODE_MAX);
  12.521 +  }
  12.522 +  modesp = modes;
  12.523 +
  12.524 +  for (modenum = 0; modenum < M_VESA_MODE_MAX; modenum++) {
  12.525 +    minfo.vi_mode = modenum;
  12.526 +    if (ioctl(0, CONS_MODEINFO, &minfo) || ioctl(0, CONS_CURRENT, &adptype))
  12.527 +      continue;
  12.528 +    if (minfo.vi_mode != modenum)
  12.529 +      continue;
  12.530 +    if ((minfo.vi_flags & V_INFO_GRAPHICS) == 0)
  12.531 +      continue;
  12.532 +    if ((mem_model != -1) && ((minfo.vi_mem_model & mem_model) == 0))
  12.533 +      continue;
  12.534 +    if ((depth > 1) && (minfo.vi_depth != depth))
  12.535 +      continue;
  12.536 +
  12.537 +    /* reallocf can fail */
  12.538 +    if ((*modesp = reallocf(*modesp, sizeof(VGLMode))) == NULL)
  12.539 +      return NULL;
  12.540 +    modescp = *modesp;
  12.541 +
  12.542 +    vminfop = &(modescp->ModeInfo);
  12.543 +    bzero(vminfop, sizeof(VGLBitmap));
  12.544 +
  12.545 +    vminfop->Type = NOBUF;
  12.546 +
  12.547 +    vminfop->PixelBytes = 1;	/* Good default value */
  12.548 +    switch (minfo.vi_mem_model) {
  12.549 +    case V_INFO_MM_PLANAR:
  12.550 +      /* we can handle EGA/VGA planar modes only */
  12.551 +      if (!(minfo.vi_depth != 4 || minfo.vi_planes != 4
  12.552 +	    || (adptype != KD_EGA && adptype != KD_VGA)))
  12.553 +	vminfop->Type = VIDBUF4;
  12.554 +      break;
  12.555 +    case V_INFO_MM_PACKED:
  12.556 +      /* we can do only 256 color packed modes */
  12.557 +      if (minfo.vi_depth == 8)
  12.558 +	vminfop->Type = VIDBUF8;
  12.559 +      break;
  12.560 +    case V_INFO_MM_VGAX:
  12.561 +      vminfop->Type = VIDBUF8X;
  12.562 +      break;
  12.563 +#if defined(__FreeBSD_version) && __FreeBSD_version >= 500000
  12.564 +    case V_INFO_MM_DIRECT:
  12.565 +      vminfop->PixelBytes = minfo.vi_pixel_size;
  12.566 +      switch (vminfop->PixelBytes) {
  12.567 +      case 2:
  12.568 +	vminfop->Type = VIDBUF16;
  12.569 +	break;
  12.570 +#if notyet
  12.571 +      case 3:
  12.572 +	vminfop->Type = VIDBUF24;
  12.573 +	break;
  12.574 +#endif
  12.575 +      case 4:
  12.576 +	vminfop->Type = VIDBUF32;
  12.577 +	break;
  12.578 +      default:
  12.579 +	break;
  12.580 +      }
  12.581 +#endif
  12.582 +    default:
  12.583 +      break;
  12.584 +    }
  12.585 +    if (vminfop->Type == NOBUF)
  12.586 +      continue;
  12.587 +
  12.588 +    switch (vminfop->Type) {
  12.589 +    case VIDBUF16:
  12.590 +    case VIDBUF32:
  12.591 +      modescp->Rmask = ((1 << minfo.vi_pixel_fsizes[VGL_RED_INDEX]) - 1) <<
  12.592 +		       minfo.vi_pixel_fields[VGL_RED_INDEX];
  12.593 +      modescp->Gmask = ((1 << minfo.vi_pixel_fsizes[VGL_GREEN_INDEX]) - 1) <<
  12.594 +		       minfo.vi_pixel_fields[VGL_GREEN_INDEX];
  12.595 +      modescp->Bmask = ((1 << minfo.vi_pixel_fsizes[VGL_BLUE_INDEX]) - 1) <<
  12.596 +		       minfo.vi_pixel_fields[VGL_BLUE_INDEX];
  12.597 +      break;
  12.598 +
  12.599 +    default:
  12.600 +      break;
  12.601 +    }
  12.602 +
  12.603 +    vminfop->Xsize = minfo.vi_width;
  12.604 +    vminfop->Ysize = minfo.vi_height;
  12.605 +    modescp->Depth = minfo.vi_depth;
  12.606 +
  12.607 +    /* XXX */
  12.608 +    if (minfo.vi_mode >= M_VESA_BASE)
  12.609 +      modescp->ModeId = _IO('V', minfo.vi_mode - M_VESA_BASE);
  12.610 +    else
  12.611 +      modescp->ModeId = _IO('S', minfo.vi_mode);
  12.612 +
  12.613 +    /* Sort list */
  12.614 +    for (i = 0; modes + i < modesp ; i++) {
  12.615 +      if (modes[i]->ModeInfo.Xsize * modes[i]->ModeInfo.Ysize >
  12.616 +	  vminfop->Xsize * modes[i]->ModeInfo.Ysize)
  12.617 +	continue;
  12.618 +      if ((modes[i]->ModeInfo.Xsize * modes[i]->ModeInfo.Ysize ==
  12.619 +	   vminfop->Xsize * vminfop->Ysize) &&
  12.620 +	  (modes[i]->Depth >= modescp->Depth))
  12.621 +	continue;
  12.622 +      *modesp = modes[i];
  12.623 +      modes[i] = modescp;
  12.624 +      modescp = *modesp;
  12.625 +      vminfop = &(modescp->ModeInfo);
  12.626 +    }
  12.627 +
  12.628 +    modesp++;
  12.629 +  }
  12.630 +
  12.631 +  if (*modesp != NULL) {
  12.632 +    free(*modesp);
  12.633 +    *modesp = NULL;
  12.634 +  }
  12.635 +
  12.636 +  return modes;
  12.637 +}
  12.638 +
  12.639 +static void
  12.640 +VGLWaitRetrace(void)
  12.641 +{
  12.642 +  while (!(inb(0x3DA) & 8));
  12.643 +  while (inb(0x3DA) & 8);
  12.644 +}
  12.645 +
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/video/vgl/SDL_vglvideo.h	Tue Jun 19 13:33:54 2001 +0000
    13.3 @@ -0,0 +1,69 @@
    13.4 +/*
    13.5 +    SDL - Simple DirectMedia Layer
    13.6 +    Copyright (C) 1997, 1998, 1999, 2000  Sam Lantinga
    13.7 +
    13.8 +    This library is free software; you can redistribute it and/or
    13.9 +    modify it under the terms of the GNU Library General Public
   13.10 +    License as published by the Free Software Foundation; either
   13.11 +    version 2 of the License, or (at your option) any later version.
   13.12 +
   13.13 +    This library is distributed in the hope that it will be useful,
   13.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13.16 +    Library General Public License for more details.
   13.17 +
   13.18 +    You should have received a copy of the GNU Library General Public
   13.19 +    License along with this library; if not, write to the Free
   13.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   13.21 +
   13.22 +    Sam Lantinga
   13.23 +    slouken@devolution.com
   13.24 +*/
   13.25 +
   13.26 +#ifdef SAVE_RCSID
   13.27 +static char rcsid =
   13.28 + "@(#) $Id$";
   13.29 +#endif
   13.30 +
   13.31 +#ifndef _SDL_vglvideo_h
   13.32 +#define _SDL_vglvideo_h
   13.33 +
   13.34 +#include <sys/fbio.h>
   13.35 +#include <sys/consio.h>
   13.36 +#include <vgl.h>
   13.37 +
   13.38 +#include "SDL_mouse.h"
   13.39 +#include "SDL_mutex.h"
   13.40 +#include "SDL_sysvideo.h"
   13.41 +
   13.42 +/* Hidden "this" pointer for the video functions */
   13.43 +#define _THIS	SDL_VideoDevice *this
   13.44 +
   13.45 +typedef struct {
   13.46 +	int ModeId;
   13.47 +	int Depth;
   13.48 +	int Rmask;
   13.49 +	int Gmask;
   13.50 +	int Bmask;
   13.51 +	VGLBitmap ModeInfo;
   13.52 +} VGLMode;
   13.53 +
   13.54 +/* Private display data */
   13.55 +struct SDL_PrivateVideoData {
   13.56 +#define NUM_MODELISTS	4		/* 8, 16, 24, and 32 bits-per-pixel */
   13.57 +	int SDL_nummodes[NUM_MODELISTS];
   13.58 +	SDL_Rect **SDL_modelist[NUM_MODELISTS];
   13.59 +	SDL_mutex *hw_lock;
   13.60 +	VGLMode *VGLCurMode;
   13.61 +	int flip_page;
   13.62 +	byte *flip_address[2];
   13.63 +};
   13.64 +/* Old variable names */
   13.65 +#define SDL_nummodes	(this->hidden->SDL_nummodes)
   13.66 +#define SDL_modelist	(this->hidden->SDL_modelist)
   13.67 +#define hw_lock		(this->hidden->hw_lock)
   13.68 +#define VGLCurMode	(this->hidden->VGLCurMode)
   13.69 +#define flip_page	(this->hidden->flip_page)
   13.70 +#define flip_address	(this->hidden->flip_address)
   13.71 +
   13.72 +#endif /* _SDL_vglvideo_h */
    14.1 --- a/src/video/x11/SDL_x11events.c	Sat Jun 16 06:47:45 2001 +0000
    14.2 +++ b/src/video/x11/SDL_x11events.c	Tue Jun 19 13:33:54 2001 +0000
    14.3 @@ -37,7 +37,9 @@
    14.4  #ifdef __SVR4
    14.5  #include <X11/Sunkeysym.h>
    14.6  #endif
    14.7 +#include <sys/types.h>
    14.8  #include <sys/time.h>
    14.9 +#include <unistd.h>
   14.10  
   14.11  #include "SDL.h"
   14.12  #include "SDL_syswm.h"