Removed outdated VGL support
authorSam Lantinga <slouken@libsdl.org>
Sat, 19 Sep 2009 07:30:29 +0000
changeset 3276720d176be107
parent 3275 a4a34a511ba0
child 3277 20326ba2bda2
Removed outdated VGL support
configure.in
include/SDL_config.h.in
src/video/SDL_sysvideo.h
src/video/SDL_video.c
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
     1.1 --- a/configure.in	Sat Sep 19 07:28:59 2009 +0000
     1.2 +++ b/configure.in	Sat Sep 19 07:30:29 2009 +0000
     1.3 @@ -1529,38 +1529,6 @@
     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 -AC_HELP_STRING([--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 -         bitmap.Type = VIDBUF32;
    1.24 -         bitmap.PixelBytes = 4;
    1.25 -         exit(bitmap.Bitmap);
    1.26 -        ],[
    1.27 -        video_vgl=yes
    1.28 -        ])
    1.29 -        AC_MSG_RESULT($video_vgl)
    1.30 -        if test x$video_vgl = xyes; then
    1.31 -            AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
    1.32 -            SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
    1.33 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvgl"
    1.34 -            have_video=yes
    1.35 -        fi
    1.36 -    fi
    1.37 -}
    1.38 -
    1.39  dnl Set up the Atari Bios keyboard driver
    1.40  CheckAtariBiosEvent()
    1.41  {
    1.42 @@ -2365,8 +2333,6 @@
    1.43          CheckPS2GS
    1.44          CheckPS3
    1.45          CheckSVGA
    1.46 -        CheckVGL
    1.47 -        CheckWscons
    1.48          CheckOpenGLX11
    1.49          CheckInputEvents
    1.50          CheckTslib
     2.1 --- a/include/SDL_config.h.in	Sat Sep 19 07:28:59 2009 +0000
     2.2 +++ b/include/SDL_config.h.in	Sat Sep 19 07:30:29 2009 +0000
     2.3 @@ -263,7 +263,6 @@
     2.4  #undef SDL_VIDEO_DRIVER_PS3
     2.5  #undef SDL_VIDEO_DRIVER_RISCOS
     2.6  #undef SDL_VIDEO_DRIVER_SVGALIB
     2.7 -#undef SDL_VIDEO_DRIVER_VGL
     2.8  #undef SDL_VIDEO_DRIVER_WIN32
     2.9  #undef SDL_VIDEO_DRIVER_X11
    2.10  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
     3.1 --- a/src/video/SDL_sysvideo.h	Sat Sep 19 07:28:59 2009 +0000
     3.2 +++ b/src/video/SDL_sysvideo.h	Sat Sep 19 07:30:29 2009 +0000
     3.3 @@ -353,9 +353,6 @@
     3.4  #if SDL_VIDEO_DRIVER_PS3
     3.5  extern VideoBootStrap PS3_bootstrap;
     3.6  #endif
     3.7 -#if SDL_VIDEO_DRIVER_VGL
     3.8 -extern VideoBootStrap VGL_bootstrap;
     3.9 -#endif
    3.10  #if SDL_VIDEO_DRIVER_SVGALIB
    3.11  extern VideoBootStrap SVGALIB_bootstrap;
    3.12  #endif
     4.1 --- a/src/video/SDL_video.c	Sat Sep 19 07:28:59 2009 +0000
     4.2 +++ b/src/video/SDL_video.c	Sat Sep 19 07:30:29 2009 +0000
     4.3 @@ -67,9 +67,6 @@
     4.4  #if SDL_VIDEO_DRIVER_PS3
     4.5      &PS3_bootstrap,
     4.6  #endif
     4.7 -#if SDL_VIDEO_DRIVER_VGL
     4.8 -    &VGL_bootstrap,
     4.9 -#endif
    4.10  #if SDL_VIDEO_DRIVER_SVGALIB
    4.11      &SVGALIB_bootstrap,
    4.12  #endif
     5.1 --- a/src/video/vgl/SDL_vglevents.c	Sat Sep 19 07:28:59 2009 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,306 +0,0 @@
     5.4 -/*
     5.5 -    SDL - Simple DirectMedia Layer
     5.6 -    Copyright (C) 1997-2009 Sam Lantinga
     5.7 -
     5.8 -    This library is free software; you can redistribute it and/or
     5.9 -    modify it under the terms of the GNU Lesser General Public
    5.10 -    License as published by the Free Software Foundation; either
    5.11 -    version 2.1 of the License, or (at your option) any later version.
    5.12 -
    5.13 -    This library is distributed in the hope that it will be useful,
    5.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    5.16 -    Lesser General Public License for more details.
    5.17 -
    5.18 -    You should have received a copy of the GNU Lesser General Public
    5.19 -    License along with this library; if not, write to the Free Software
    5.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    5.21 -
    5.22 -    Sam Lantinga
    5.23 -    slouken@libsdl.org
    5.24 -*/
    5.25 -#include "SDL_config.h"
    5.26 -
    5.27 -/* Handle the event stream, converting X11 events into SDL events */
    5.28 -
    5.29 -#include <stdio.h>
    5.30 -
    5.31 -#include <sys/fbio.h>
    5.32 -#include <sys/consio.h>
    5.33 -#include <sys/kbio.h>
    5.34 -#include <vgl.h>
    5.35 -
    5.36 -#include "SDL_thread.h"
    5.37 -#include "../../events/SDL_sysevents.h"
    5.38 -#include "../../events/SDL_events_c.h"
    5.39 -#include "SDL_vglvideo.h"
    5.40 -#include "SDL_vglevents_c.h"
    5.41 -
    5.42 -/* The translation tables from a console scancode to a SDL keysym */
    5.43 -/* FIXME: Free the keymap when we shut down the video mode */
    5.44 -static keymap_t *vga_keymap = NULL;
    5.45 -static SDLKey keymap[128];
    5.46 -static SDL_keysym *TranslateKey(int scancode, SDL_keysym * keysym);
    5.47 -
    5.48 -static int posted = 0;
    5.49 -static int oldx = -1;
    5.50 -static int oldy = -1;
    5.51 -static struct mouse_info mouseinfo;
    5.52 -
    5.53 -/* Ugh, we have to duplicate the kernel's keysym mapping code...
    5.54 -   Oh, it's not so bad. :-)
    5.55 -
    5.56 -   FIXME: Add keyboard LED handling code
    5.57 - */
    5.58 -int
    5.59 -VGL_initkeymaps(int fd)
    5.60 -{
    5.61 -    vga_keymap = SDL_malloc(sizeof(keymap_t));
    5.62 -    if (!vga_keymap) {
    5.63 -        SDL_OutOfMemory();
    5.64 -        return (-1);
    5.65 -    }
    5.66 -    if (ioctl(fd, GIO_KEYMAP, vga_keymap) == -1) {
    5.67 -        SDL_free(vga_keymap);
    5.68 -        vga_keymap = NULL;
    5.69 -        SDL_SetError("Unable to get keyboard map");
    5.70 -        return (-1);
    5.71 -    }
    5.72 -    return (0);
    5.73 -}
    5.74 -
    5.75 -static void
    5.76 -handle_keyboard(_THIS)
    5.77 -{
    5.78 -    SDL_keysym keysym;
    5.79 -    int c, pressed, scancode;
    5.80 -
    5.81 -    while ((c = VGLKeyboardGetCh()) != 0) {
    5.82 -        scancode = c & 0x7F;
    5.83 -        if (c & 0x80) {
    5.84 -            pressed = SDL_RELEASED;
    5.85 -        } else {
    5.86 -            pressed = SDL_PRESSED;
    5.87 -        }
    5.88 -
    5.89 -        posted += SDL_PrivateKeyboard(pressed,
    5.90 -                                      TranslateKey(scancode, &keysym));
    5.91 -    }
    5.92 -}
    5.93 -
    5.94 -int
    5.95 -VGL_initmouse(int fd)
    5.96 -{
    5.97 -    mouseinfo.operation = MOUSE_GETINFO;
    5.98 -    if (ioctl(fd, CONS_MOUSECTL, &mouseinfo) != 0)
    5.99 -        return -1;
   5.100 -
   5.101 -    return 0;
   5.102 -}
   5.103 -
   5.104 -static void
   5.105 -handle_mouse(_THIS)
   5.106 -{
   5.107 -    char buttons;
   5.108 -    int x, y;
   5.109 -    int button_state, state_changed, state;
   5.110 -    int i;
   5.111 -
   5.112 -    ioctl(0, CONS_MOUSECTL, &mouseinfo);
   5.113 -    x = mouseinfo.u.data.x;
   5.114 -    y = mouseinfo.u.data.y;
   5.115 -    buttons = mouseinfo.u.data.buttons;
   5.116 -
   5.117 -    if ((x != oldx) || (y != oldy)) {
   5.118 -        posted += SDL_PrivateMouseMotion(0, 0, x, y);
   5.119 -        oldx = x;
   5.120 -        oldy = y;
   5.121 -    }
   5.122 -
   5.123 -    /* See what's changed */
   5.124 -    button_state = SDL_GetMouseState(NULL, NULL);
   5.125 -    state_changed = button_state ^ buttons;
   5.126 -    for (i = 0; i < 8; i++) {
   5.127 -        if (state_changed & (1 << i)) {
   5.128 -            if (buttons & (1 << i)) {
   5.129 -                state = SDL_PRESSED;
   5.130 -            } else {
   5.131 -                state = SDL_RELEASED;
   5.132 -            }
   5.133 -            posted += SDL_PrivateMouseButton(state, i + 1, 0, 0);
   5.134 -        }
   5.135 -    }
   5.136 -}
   5.137 -
   5.138 -
   5.139 -void
   5.140 -VGL_PumpEvents(_THIS)
   5.141 -{
   5.142 -    do {
   5.143 -        posted = 0;
   5.144 -        handle_keyboard(this);
   5.145 -        handle_mouse(this);
   5.146 -    } while (posted != 0);
   5.147 -}
   5.148 -
   5.149 -void
   5.150 -VGL_InitOSKeymap(_THIS)
   5.151 -{
   5.152 -    int i;
   5.153 -
   5.154 -    /* Initialize the BeOS key translation table */
   5.155 -    for (i = 0; i < SDL_arraysize(keymap); ++i)
   5.156 -        keymap[i] = SDLK_UNKNOWN;
   5.157 -
   5.158 -    keymap[SCANCODE_ESCAPE] = SDLK_ESCAPE;
   5.159 -    keymap[SCANCODE_1] = SDLK_1;
   5.160 -    keymap[SCANCODE_2] = SDLK_2;
   5.161 -    keymap[SCANCODE_3] = SDLK_3;
   5.162 -    keymap[SCANCODE_4] = SDLK_4;
   5.163 -    keymap[SCANCODE_5] = SDLK_5;
   5.164 -    keymap[SCANCODE_6] = SDLK_6;
   5.165 -    keymap[SCANCODE_7] = SDLK_7;
   5.166 -    keymap[SCANCODE_8] = SDLK_8;
   5.167 -    keymap[SCANCODE_9] = SDLK_9;
   5.168 -    keymap[SCANCODE_0] = SDLK_0;
   5.169 -    keymap[SCANCODE_MINUS] = SDLK_MINUS;
   5.170 -    keymap[SCANCODE_EQUAL] = SDLK_EQUALS;
   5.171 -    keymap[SCANCODE_BACKSPACE] = SDLK_BACKSPACE;
   5.172 -    keymap[SCANCODE_TAB] = SDLK_TAB;
   5.173 -    keymap[SCANCODE_Q] = SDLK_q;
   5.174 -    keymap[SCANCODE_W] = SDLK_w;
   5.175 -    keymap[SCANCODE_E] = SDLK_e;
   5.176 -    keymap[SCANCODE_R] = SDLK_r;
   5.177 -    keymap[SCANCODE_T] = SDLK_t;
   5.178 -    keymap[SCANCODE_Y] = SDLK_y;
   5.179 -    keymap[SCANCODE_U] = SDLK_u;
   5.180 -    keymap[SCANCODE_I] = SDLK_i;
   5.181 -    keymap[SCANCODE_O] = SDLK_o;
   5.182 -    keymap[SCANCODE_P] = SDLK_p;
   5.183 -    keymap[SCANCODE_BRACKET_LEFT] = SDLK_LEFTBRACKET;
   5.184 -    keymap[SCANCODE_BRACKET_RIGHT] = SDLK_RIGHTBRACKET;
   5.185 -    keymap[SCANCODE_ENTER] = SDLK_RETURN;
   5.186 -    keymap[SCANCODE_LEFTCONTROL] = SDLK_LCTRL;
   5.187 -    keymap[SCANCODE_A] = SDLK_a;
   5.188 -    keymap[SCANCODE_S] = SDLK_s;
   5.189 -    keymap[SCANCODE_D] = SDLK_d;
   5.190 -    keymap[SCANCODE_F] = SDLK_f;
   5.191 -    keymap[SCANCODE_G] = SDLK_g;
   5.192 -    keymap[SCANCODE_H] = SDLK_h;
   5.193 -    keymap[SCANCODE_J] = SDLK_j;
   5.194 -    keymap[SCANCODE_K] = SDLK_k;
   5.195 -    keymap[SCANCODE_L] = SDLK_l;
   5.196 -    keymap[SCANCODE_SEMICOLON] = SDLK_SEMICOLON;
   5.197 -    keymap[SCANCODE_APOSTROPHE] = SDLK_QUOTE;
   5.198 -    keymap[SCANCODE_GRAVE] = SDLK_BACKQUOTE;
   5.199 -    keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT;
   5.200 -    keymap[SCANCODE_BACKSLASH] = SDLK_BACKSLASH;
   5.201 -    keymap[SCANCODE_Z] = SDLK_z;
   5.202 -    keymap[SCANCODE_X] = SDLK_x;
   5.203 -    keymap[SCANCODE_C] = SDLK_c;
   5.204 -    keymap[SCANCODE_V] = SDLK_v;
   5.205 -    keymap[SCANCODE_B] = SDLK_b;
   5.206 -    keymap[SCANCODE_N] = SDLK_n;
   5.207 -    keymap[SCANCODE_M] = SDLK_m;
   5.208 -    keymap[SCANCODE_COMMA] = SDLK_COMMA;
   5.209 -    keymap[SCANCODE_PERIOD] = SDLK_PERIOD;
   5.210 -    keymap[SCANCODE_SLASH] = SDLK_SLASH;
   5.211 -    keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT;
   5.212 -    keymap[SCANCODE_KEYPADMULTIPLY] = SDLK_KP_MULTIPLY;
   5.213 -    keymap[SCANCODE_LEFTALT] = SDLK_LALT;
   5.214 -    keymap[SCANCODE_SPACE] = SDLK_SPACE;
   5.215 -    keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
   5.216 -    keymap[SCANCODE_F1] = SDLK_F1;
   5.217 -    keymap[SCANCODE_F2] = SDLK_F2;
   5.218 -    keymap[SCANCODE_F3] = SDLK_F3;
   5.219 -    keymap[SCANCODE_F4] = SDLK_F4;
   5.220 -    keymap[SCANCODE_F5] = SDLK_F5;
   5.221 -    keymap[SCANCODE_F6] = SDLK_F6;
   5.222 -    keymap[SCANCODE_F7] = SDLK_F7;
   5.223 -    keymap[SCANCODE_F8] = SDLK_F8;
   5.224 -    keymap[SCANCODE_F9] = SDLK_F9;
   5.225 -    keymap[SCANCODE_F10] = SDLK_F10;
   5.226 -    keymap[SCANCODE_NUMLOCK] = SDLK_NUMLOCK;
   5.227 -    keymap[SCANCODE_SCROLLLOCK] = SDLK_SCROLLOCK;
   5.228 -    keymap[SCANCODE_KEYPAD7] = SDLK_KP7;
   5.229 -    keymap[SCANCODE_CURSORUPLEFT] = SDLK_KP7;
   5.230 -    keymap[SCANCODE_KEYPAD8] = SDLK_KP8;
   5.231 -    keymap[SCANCODE_CURSORUP] = SDLK_KP8;
   5.232 -    keymap[SCANCODE_KEYPAD9] = SDLK_KP9;
   5.233 -    keymap[SCANCODE_CURSORUPRIGHT] = SDLK_KP9;
   5.234 -    keymap[SCANCODE_KEYPADMINUS] = SDLK_KP_MINUS;
   5.235 -    keymap[SCANCODE_KEYPAD4] = SDLK_KP4;
   5.236 -    keymap[SCANCODE_CURSORLEFT] = SDLK_KP4;
   5.237 -    keymap[SCANCODE_KEYPAD5] = SDLK_KP5;
   5.238 -    keymap[SCANCODE_KEYPAD6] = SDLK_KP6;
   5.239 -    keymap[SCANCODE_CURSORRIGHT] = SDLK_KP6;
   5.240 -    keymap[SCANCODE_KEYPADPLUS] = SDLK_KP_PLUS;
   5.241 -    keymap[SCANCODE_KEYPAD1] = SDLK_KP1;
   5.242 -    keymap[SCANCODE_CURSORDOWNLEFT] = SDLK_KP1;
   5.243 -    keymap[SCANCODE_KEYPAD2] = SDLK_KP2;
   5.244 -    keymap[SCANCODE_CURSORDOWN] = SDLK_KP2;
   5.245 -    keymap[SCANCODE_KEYPAD3] = SDLK_KP3;
   5.246 -    keymap[SCANCODE_CURSORDOWNRIGHT] = SDLK_KP3;
   5.247 -    keymap[SCANCODE_KEYPAD0] = SDLK_KP0;
   5.248 -    keymap[SCANCODE_KEYPADPERIOD] = SDLK_KP_PERIOD;
   5.249 -    keymap[SCANCODE_LESS] = SDLK_LESS;
   5.250 -    keymap[SCANCODE_F11] = SDLK_F11;
   5.251 -    keymap[SCANCODE_F12] = SDLK_F12;
   5.252 -    keymap[SCANCODE_KEYPADENTER] = SDLK_KP_ENTER;
   5.253 -    keymap[SCANCODE_RIGHTCONTROL] = SDLK_RCTRL;
   5.254 -    keymap[SCANCODE_CONTROL] = SDLK_RCTRL;
   5.255 -    keymap[SCANCODE_KEYPADDIVIDE] = SDLK_KP_DIVIDE;
   5.256 -    keymap[SCANCODE_PRINTSCREEN] = SDLK_PRINT;
   5.257 -    keymap[SCANCODE_RIGHTALT] = SDLK_RALT;
   5.258 -    keymap[SCANCODE_BREAK] = SDLK_BREAK;
   5.259 -    keymap[SCANCODE_BREAK_ALTERNATIVE] = SDLK_UNKNOWN;
   5.260 -    keymap[SCANCODE_HOME] = SDLK_HOME;
   5.261 -    keymap[SCANCODE_CURSORBLOCKUP] = SDLK_UP;
   5.262 -    keymap[SCANCODE_PAGEUP] = SDLK_PAGEUP;
   5.263 -    keymap[SCANCODE_CURSORBLOCKLEFT] = SDLK_LEFT;
   5.264 -    keymap[SCANCODE_CURSORBLOCKRIGHT] = SDLK_RIGHT;
   5.265 -    keymap[SCANCODE_END] = SDLK_END;
   5.266 -    keymap[SCANCODE_CURSORBLOCKDOWN] = SDLK_DOWN;
   5.267 -    keymap[SCANCODE_PAGEDOWN] = SDLK_PAGEDOWN;
   5.268 -    keymap[SCANCODE_INSERT] = SDLK_INSERT;
   5.269 -    keymap[SCANCODE_REMOVE] = SDLK_DELETE;
   5.270 -    keymap[119] = SDLK_PAUSE;
   5.271 -    keymap[SCANCODE_RIGHTWIN] = SDLK_RSUPER;
   5.272 -    keymap[SCANCODE_LEFTWIN] = SDLK_LSUPER;
   5.273 -    keymap[127] = SDLK_MENU;
   5.274 -}
   5.275 -
   5.276 -static SDL_keysym *
   5.277 -TranslateKey(int scancode, SDL_keysym * keysym)
   5.278 -{
   5.279 -    /* Set the keysym information */
   5.280 -    keysym->scancode = scancode;
   5.281 -    keysym->sym = keymap[scancode];
   5.282 -    keysym->mod = KMOD_NONE;
   5.283 -
   5.284 -    /* If UNICODE is on, get the UNICODE value for the key */
   5.285 -    keysym->unicode = 0;
   5.286 -    if (SDL_TranslateUNICODE && vga_keymap) {
   5.287 -        int map;
   5.288 -        SDLMod modstate;
   5.289 -
   5.290 -        modstate = SDL_GetModState();
   5.291 -        map = 0;
   5.292 -        if (modstate & KMOD_SHIFT) {
   5.293 -            map += 1;
   5.294 -        }
   5.295 -        if (modstate & KMOD_CTRL) {
   5.296 -            map += 2;
   5.297 -        }
   5.298 -        if (modstate & KMOD_ALT) {
   5.299 -            map += 4;
   5.300 -        }
   5.301 -        if (!(vga_keymap->key[scancode].spcl & (0x80 >> map))) {
   5.302 -            keysym->unicode = vga_keymap->key[scancode].map[map];
   5.303 -        }
   5.304 -
   5.305 -    }
   5.306 -    return (keysym);
   5.307 -}
   5.308 -
   5.309 -/* vi: set ts=4 sw=4 expandtab: */
     6.1 --- a/src/video/vgl/SDL_vglevents_c.h	Sat Sep 19 07:28:59 2009 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,156 +0,0 @@
     6.4 -/*
     6.5 -    SDL - Simple DirectMedia Layer
     6.6 -    Copyright (C) 1997-2009 Sam Lantinga
     6.7 -
     6.8 -    This library is free software; you can redistribute it and/or
     6.9 -    modify it under the terms of the GNU Lesser General Public
    6.10 -    License as published by the Free Software Foundation; either
    6.11 -    version 2.1 of the License, or (at your option) any later version.
    6.12 -
    6.13 -    This library is distributed in the hope that it will be useful,
    6.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    6.16 -    Lesser General Public License for more details.
    6.17 -
    6.18 -    You should have received a copy of the GNU Lesser General Public
    6.19 -    License along with this library; if not, write to the Free Software
    6.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    6.21 -
    6.22 -    Sam Lantinga
    6.23 -    slouken@libsdl.org
    6.24 -*/
    6.25 -#include "SDL_config.h"
    6.26 -
    6.27 -#include "SDL_vglvideo.h"
    6.28 -
    6.29 -/* Variables and functions exported by SDL_sysevents.c to other parts 
    6.30 -   of the native video subsystem (SDL_sysvideo.c)
    6.31 -*/
    6.32 -extern int VGL_initkeymaps(int fd);
    6.33 -extern int VGL_initmouse(int fd);
    6.34 -extern void VGL_keyboardcallback(int scancode, int pressed);
    6.35 -
    6.36 -extern void VGL_InitOSKeymap(_THIS);
    6.37 -extern void VGL_PumpEvents(_THIS);
    6.38 -
    6.39 -/* Mouse buttons */
    6.40 -#define MOUSE_LEFTBUTTON        0x01
    6.41 -#define MOUSE_MIDDLEBUTTON      0x02
    6.42 -#define MOUSE_RIGHTBUTTON       0x04
    6.43 -
    6.44 -/* Scancodes */
    6.45 -#define SCANCODE_ESCAPE			1
    6.46 -#define SCANCODE_1			2
    6.47 -#define SCANCODE_2			3
    6.48 -#define SCANCODE_3			4
    6.49 -#define SCANCODE_4			5
    6.50 -#define SCANCODE_5			6
    6.51 -#define SCANCODE_6			7
    6.52 -#define SCANCODE_7			8
    6.53 -#define SCANCODE_8			9
    6.54 -#define SCANCODE_9			10
    6.55 -#define SCANCODE_0			11
    6.56 -#define SCANCODE_MINUS			12
    6.57 -#define SCANCODE_EQUAL			13
    6.58 -#define SCANCODE_BACKSPACE		14
    6.59 -#define SCANCODE_TAB			15
    6.60 -#define SCANCODE_Q			16
    6.61 -#define SCANCODE_W			17
    6.62 -#define SCANCODE_E			18
    6.63 -#define SCANCODE_R			19
    6.64 -#define SCANCODE_T			20
    6.65 -#define SCANCODE_Y			21
    6.66 -#define SCANCODE_U			22
    6.67 -#define SCANCODE_I			23
    6.68 -#define SCANCODE_O			24
    6.69 -#define SCANCODE_P			25
    6.70 -#define SCANCODE_BRACKET_LEFT		26
    6.71 -#define SCANCODE_BRACKET_RIGHT		27
    6.72 -#define SCANCODE_ENTER			28
    6.73 -#define SCANCODE_LEFTCONTROL		29
    6.74 -#define SCANCODE_A			30
    6.75 -#define SCANCODE_S			31
    6.76 -#define SCANCODE_D			32
    6.77 -#define SCANCODE_F			33
    6.78 -#define SCANCODE_G			34
    6.79 -#define SCANCODE_H			35
    6.80 -#define SCANCODE_J			36
    6.81 -#define SCANCODE_K			37
    6.82 -#define SCANCODE_L			38
    6.83 -#define SCANCODE_SEMICOLON		39
    6.84 -#define SCANCODE_APOSTROPHE		40
    6.85 -#define SCANCODE_GRAVE			41
    6.86 -#define SCANCODE_LEFTSHIFT		42
    6.87 -#define SCANCODE_BACKSLASH		43
    6.88 -#define SCANCODE_Z			44
    6.89 -#define SCANCODE_X			45
    6.90 -#define SCANCODE_C			46
    6.91 -#define SCANCODE_V			47
    6.92 -#define SCANCODE_B			48
    6.93 -#define SCANCODE_N			49
    6.94 -#define SCANCODE_M			50
    6.95 -#define SCANCODE_COMMA			51
    6.96 -#define SCANCODE_PERIOD			52
    6.97 -#define SCANCODE_SLASH			53
    6.98 -#define SCANCODE_RIGHTSHIFT		54
    6.99 -#define SCANCODE_KEYPADMULTIPLY		55
   6.100 -#define SCANCODE_LEFTALT		56
   6.101 -#define SCANCODE_SPACE			57
   6.102 -#define SCANCODE_CAPSLOCK		58
   6.103 -#define SCANCODE_F1			59
   6.104 -#define SCANCODE_F2			60
   6.105 -#define SCANCODE_F3			61
   6.106 -#define SCANCODE_F4			62
   6.107 -#define SCANCODE_F5			63
   6.108 -#define SCANCODE_F6			64
   6.109 -#define SCANCODE_F7			65
   6.110 -#define SCANCODE_F8			66
   6.111 -#define SCANCODE_F9			67
   6.112 -#define SCANCODE_F10			68
   6.113 -#define SCANCODE_NUMLOCK		69
   6.114 -#define SCANCODE_SCROLLLOCK		70
   6.115 -#define SCANCODE_KEYPAD7		71
   6.116 -#define SCANCODE_CURSORUPLEFT		71
   6.117 -#define SCANCODE_KEYPAD8		72
   6.118 -#define SCANCODE_CURSORUP		72
   6.119 -#define SCANCODE_KEYPAD9		73
   6.120 -#define SCANCODE_CURSORUPRIGHT		73
   6.121 -#define SCANCODE_KEYPADMINUS		74
   6.122 -#define SCANCODE_KEYPAD4		75
   6.123 -#define SCANCODE_CURSORLEFT		75
   6.124 -#define SCANCODE_KEYPAD5		76
   6.125 -#define SCANCODE_KEYPAD6		77
   6.126 -#define SCANCODE_CURSORRIGHT		77
   6.127 -#define SCANCODE_KEYPADPLUS		78
   6.128 -#define SCANCODE_KEYPAD1		79
   6.129 -#define SCANCODE_CURSORDOWNLEFT		79
   6.130 -#define SCANCODE_KEYPAD2		80
   6.131 -#define SCANCODE_CURSORDOWN		80
   6.132 -#define SCANCODE_KEYPAD3		81
   6.133 -#define SCANCODE_CURSORDOWNRIGHT	81
   6.134 -#define SCANCODE_KEYPAD0		82
   6.135 -#define SCANCODE_KEYPADPERIOD		83
   6.136 -#define SCANCODE_LESS			86
   6.137 -#define SCANCODE_F11			87
   6.138 -#define SCANCODE_F12			88
   6.139 -#define SCANCODE_KEYPADENTER		89
   6.140 -#define SCANCODE_RIGHTCONTROL		90
   6.141 -#define SCANCODE_CONTROL		107
   6.142 -#define SCANCODE_KEYPADDIVIDE		91
   6.143 -#define SCANCODE_PRINTSCREEN		92
   6.144 -#define SCANCODE_RIGHTALT		93
   6.145 -#define SCANCODE_BREAK			104     /* Beware: is 119     */
   6.146 -#define SCANCODE_BREAK_ALTERNATIVE	104     /* on some keyboards! */
   6.147 -#define SCANCODE_HOME			94
   6.148 -#define SCANCODE_CURSORBLOCKUP		95      /* Cursor key block */
   6.149 -#define SCANCODE_PAGEUP			96
   6.150 -#define SCANCODE_CURSORBLOCKLEFT	97      /* Cursor key block */
   6.151 -#define SCANCODE_CURSORBLOCKRIGHT	98      /* Cursor key block */
   6.152 -#define SCANCODE_END			99
   6.153 -#define SCANCODE_CURSORBLOCKDOWN	100     /* Cursor key block */
   6.154 -#define SCANCODE_PAGEDOWN		101
   6.155 -#define SCANCODE_INSERT			102
   6.156 -#define SCANCODE_REMOVE			103
   6.157 -#define SCANCODE_RIGHTWIN		106
   6.158 -#define SCANCODE_LEFTWIN		105
   6.159 -/* vi: set ts=4 sw=4 expandtab: */
     7.1 --- a/src/video/vgl/SDL_vglmouse.c	Sat Sep 19 07:28:59 2009 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,63 +0,0 @@
     7.4 -/*
     7.5 -    SDL - Simple DirectMedia Layer
     7.6 -    Copyright (C) 1997-2009 Sam Lantinga
     7.7 -
     7.8 -    This library is free software; you can redistribute it and/or
     7.9 -    modify it under the terms of the GNU Lesser General Public
    7.10 -    License as published by the Free Software Foundation; either
    7.11 -    version 2.1 of the License, or (at your option) any later version.
    7.12 -
    7.13 -    This library is distributed in the hope that it will be useful,
    7.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    7.16 -    Lesser General Public License for more details.
    7.17 -
    7.18 -    You should have received a copy of the GNU Lesser General Public
    7.19 -    License along with this library; if not, write to the Free Software
    7.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    7.21 -
    7.22 -    Sam Lantinga
    7.23 -    slouken@libsdl.org
    7.24 -*/
    7.25 -#include "SDL_config.h"
    7.26 -
    7.27 -#include "SDL_mouse.h"
    7.28 -#include "../../events/SDL_events_c.h"
    7.29 -#include "SDL_vglvideo.h"
    7.30 -#include "SDL_vglmouse_c.h"
    7.31 -
    7.32 -
    7.33 -/* The implementation dependent data for the window manager cursor */
    7.34 -struct WMcursor
    7.35 -{
    7.36 -    int unused;
    7.37 -};
    7.38 -
    7.39 -
    7.40 -void
    7.41 -VGL_FreeWMCursor(_THIS, WMcursor * cursor)
    7.42 -{
    7.43 -    return;
    7.44 -}
    7.45 -
    7.46 -WMcursor *
    7.47 -VGL_CreateWMCursor(_THIS,
    7.48 -                   Uint8 * data, Uint8 * mask, int w, int h, int hot_x,
    7.49 -                   int hot_y)
    7.50 -{
    7.51 -    return (NULL);
    7.52 -}
    7.53 -
    7.54 -int
    7.55 -VGL_ShowWMCursor(_THIS, WMcursor * cursor)
    7.56 -{
    7.57 -    return (0);
    7.58 -}
    7.59 -
    7.60 -void
    7.61 -VGL_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
    7.62 -{
    7.63 -    SDL_PrivateMouseMotion(0, 0, x, y);
    7.64 -}
    7.65 -
    7.66 -/* vi: set ts=4 sw=4 expandtab: */
     8.1 --- a/src/video/vgl/SDL_vglmouse_c.h	Sat Sep 19 07:28:59 2009 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,33 +0,0 @@
     8.4 -/*
     8.5 -    SDL - Simple DirectMedia Layer
     8.6 -    Copyright (C) 1997-2009 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 Lesser General Public
    8.10 -    License as published by the Free Software Foundation; either
    8.11 -    version 2.1 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 -    Lesser General Public License for more details.
    8.17 -
    8.18 -    You should have received a copy of the GNU Lesser General Public
    8.19 -    License along with this library; if not, write to the Free Software
    8.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    8.21 -
    8.22 -    Sam Lantinga
    8.23 -    slouken@libsdl.org
    8.24 -*/
    8.25 -#include "SDL_config.h"
    8.26 -
    8.27 -#include "SDL_vglvideo.h"
    8.28 -
    8.29 -/* Functions to be exported */
    8.30 -extern void VGL_FreeWMCursor(_THIS, WMcursor * cursor);
    8.31 -extern WMcursor *VGL_CreateWMCursor(_THIS,
    8.32 -                                    Uint8 * data, Uint8 * mask, int w, int h,
    8.33 -                                    int hot_x, int hot_y);
    8.34 -extern int VGL_ShowWMCursor(_THIS, WMcursor * cursor);
    8.35 -extern void VGL_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
    8.36 -/* vi: set ts=4 sw=4 expandtab: */
     9.1 --- a/src/video/vgl/SDL_vglvideo.c	Sat Sep 19 07:28:59 2009 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,664 +0,0 @@
     9.4 -/*
     9.5 -    SDL - Simple DirectMedia Layer
     9.6 -    Copyright (C) 1997-2009 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 Lesser General Public
    9.10 -    License as published by the Free Software Foundation; either
    9.11 -    version 2.1 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 -    Lesser General Public License for more details.
    9.17 -
    9.18 -    You should have received a copy of the GNU Lesser General Public
    9.19 -    License along with this library; if not, write to the Free Software
    9.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    9.21 -
    9.22 -    Sam Lantinga
    9.23 -    slouken@libsdl.org
    9.24 -*/
    9.25 -#include "SDL_config.h"
    9.26 -
    9.27 -/* libvga based SDL video driver implementation.
    9.28 -*/
    9.29 -
    9.30 -#include <err.h>
    9.31 -#include <osreldate.h>
    9.32 -#include <unistd.h>
    9.33 -#include <sys/stat.h>
    9.34 -
    9.35 -#include <sys/fbio.h>
    9.36 -#include <sys/consio.h>
    9.37 -#include <sys/kbio.h>
    9.38 -#include <vgl.h>
    9.39 -
    9.40 -#include "SDL_video.h"
    9.41 -#include "SDL_mouse.h"
    9.42 -#include "../SDL_sysvideo.h"
    9.43 -#include "../SDL_pixels_c.h"
    9.44 -#include "../../events/SDL_events_c.h"
    9.45 -#include "SDL_vglvideo.h"
    9.46 -#include "SDL_vglevents_c.h"
    9.47 -#include "SDL_vglmouse_c.h"
    9.48 -
    9.49 -
    9.50 -/* Initialization/Query functions */
    9.51 -static int VGL_VideoInit(_THIS, SDL_PixelFormat * vformat);
    9.52 -static SDL_Rect **VGL_ListModes(_THIS, SDL_PixelFormat * format,
    9.53 -                                Uint32 flags);
    9.54 -static SDL_Surface *VGL_SetVideoMode(_THIS, SDL_Surface * current, int width,
    9.55 -                                     int height, int bpp, Uint32 flags);
    9.56 -static int VGL_SetColors(_THIS, int firstcolor, int ncolors,
    9.57 -                         SDL_Color * colors);
    9.58 -static void VGL_VideoQuit(_THIS);
    9.59 -
    9.60 -/* Hardware surface functions */
    9.61 -static int VGL_AllocHWSurface(_THIS, SDL_Surface * surface);
    9.62 -static int VGL_LockHWSurface(_THIS, SDL_Surface * surface);
    9.63 -static int VGL_FlipHWSurface(_THIS, SDL_Surface * surface);
    9.64 -static void VGL_UnlockHWSurface(_THIS, SDL_Surface * surface);
    9.65 -static void VGL_FreeHWSurface(_THIS, SDL_Surface * surface);
    9.66 -
    9.67 -/* Misc function */
    9.68 -static VGLMode **VGLListModes(int depth, int mem_model);
    9.69 -static void VGLWaitRetrace(void);
    9.70 -
    9.71 -/* VGL driver bootstrap functions */
    9.72 -
    9.73 -static int
    9.74 -VGL_Available(void)
    9.75 -{
    9.76 -    /*
    9.77 -     * Check to see if we are root and stdin is a
    9.78 -     * virtual console. Also try to ensure that
    9.79 -     * modes other than 320x200 are available
    9.80 -     */
    9.81 -    int console, hires_available, i;
    9.82 -    VGLMode **modes;
    9.83 -
    9.84 -    console = STDIN_FILENO;
    9.85 -    if (console >= 0) {
    9.86 -        struct stat sb;
    9.87 -        struct vt_mode dummy;
    9.88 -
    9.89 -        if ((fstat(console, &sb) < 0) ||
    9.90 -            (ioctl(console, VT_GETMODE, &dummy) < 0)) {
    9.91 -            console = -1;
    9.92 -        }
    9.93 -    }
    9.94 -    if (geteuid() != 0 && console == -1)
    9.95 -        return 0;
    9.96 -
    9.97 -    modes = VGLListModes(8, V_INFO_MM_DIRECT | V_INFO_MM_PACKED);
    9.98 -    hires_available = 0;
    9.99 -    for (i = 0; modes[i] != NULL; i++) {
   9.100 -        if ((modes[i]->ModeInfo.Xsize > 320) &&
   9.101 -            (modes[i]->ModeInfo.Ysize > 200) &&
   9.102 -            ((modes[i]->ModeInfo.Type == VIDBUF8) ||
   9.103 -             (modes[i]->ModeInfo.Type == VIDBUF16) ||
   9.104 -             (modes[i]->ModeInfo.Type == VIDBUF32))) {
   9.105 -            hires_available = 1;
   9.106 -            break;
   9.107 -        }
   9.108 -    }
   9.109 -    return hires_available;
   9.110 -}
   9.111 -
   9.112 -static void
   9.113 -VGL_DeleteDevice(SDL_VideoDevice * device)
   9.114 -{
   9.115 -    SDL_free(device->hidden);
   9.116 -    SDL_free(device);
   9.117 -}
   9.118 -
   9.119 -static SDL_VideoDevice *
   9.120 -VGL_CreateDevice(int devindex)
   9.121 -{
   9.122 -    SDL_VideoDevice *device;
   9.123 -
   9.124 -    /* Initialize all variables that we clean on shutdown */
   9.125 -    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
   9.126 -    if (device) {
   9.127 -        SDL_memset(device, 0, (sizeof *device));
   9.128 -        device->hidden = (struct SDL_PrivateVideoData *)
   9.129 -            SDL_malloc((sizeof *device->hidden));
   9.130 -    }
   9.131 -    if ((device == NULL) || (device->hidden == NULL)) {
   9.132 -        SDL_OutOfMemory();
   9.133 -        if (device) {
   9.134 -            SDL_free(device);
   9.135 -        }
   9.136 -        return (0);
   9.137 -    }
   9.138 -    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
   9.139 -
   9.140 -    /* Set the function pointers */
   9.141 -    device->VideoInit = VGL_VideoInit;
   9.142 -    device->ListModes = VGL_ListModes;
   9.143 -    device->SetVideoMode = VGL_SetVideoMode;
   9.144 -    device->SetColors = VGL_SetColors;
   9.145 -    device->UpdateRects = NULL;
   9.146 -    device->VideoQuit = VGL_VideoQuit;
   9.147 -    device->AllocHWSurface = VGL_AllocHWSurface;
   9.148 -    device->CheckHWBlit = NULL;
   9.149 -    device->FillHWRect = NULL;
   9.150 -    device->SetHWColorKey = NULL;
   9.151 -    device->SetHWAlpha = NULL;
   9.152 -    device->LockHWSurface = VGL_LockHWSurface;
   9.153 -    device->UnlockHWSurface = VGL_UnlockHWSurface;
   9.154 -    device->FlipHWSurface = VGL_FlipHWSurface;
   9.155 -    device->FreeHWSurface = VGL_FreeHWSurface;
   9.156 -    device->SetIcon = NULL;
   9.157 -    device->SetCaption = NULL;
   9.158 -    device->GetWMInfo = NULL;
   9.159 -    device->FreeWMCursor = VGL_FreeWMCursor;
   9.160 -    device->CreateWMCursor = VGL_CreateWMCursor;
   9.161 -    device->ShowWMCursor = VGL_ShowWMCursor;
   9.162 -    device->WarpWMCursor = VGL_WarpWMCursor;
   9.163 -    device->InitOSKeymap = VGL_InitOSKeymap;
   9.164 -    device->PumpEvents = VGL_PumpEvents;
   9.165 -
   9.166 -    device->free = VGL_DeleteDevice;
   9.167 -
   9.168 -    return device;
   9.169 -}
   9.170 -
   9.171 -VideoBootStrap VGL_bootstrap = {
   9.172 -    "vgl", "FreeBSD libVGL",
   9.173 -    VGL_Available, VGL_CreateDevice
   9.174 -};
   9.175 -
   9.176 -static int
   9.177 -VGL_AddMode(_THIS, VGLMode * inmode)
   9.178 -{
   9.179 -    SDL_Rect *mode;
   9.180 -
   9.181 -    int i, index;
   9.182 -    int next_mode;
   9.183 -
   9.184 -    /* Check to see if we already have this mode */
   9.185 -    if (inmode->Depth < 8) {    /* Not supported */
   9.186 -        return 0;
   9.187 -    }
   9.188 -    index = ((inmode->Depth + 7) / 8) - 1;
   9.189 -    for (i = 0; i < SDL_nummodes[index]; ++i) {
   9.190 -        mode = SDL_modelist[index][i];
   9.191 -        if ((mode->w == inmode->ModeInfo.Xsize) &&
   9.192 -            (mode->h == inmode->ModeInfo.Ysize))
   9.193 -            return 0;
   9.194 -    }
   9.195 -
   9.196 -    /* Set up the new video mode rectangle */
   9.197 -    mode = (SDL_Rect *) SDL_malloc(sizeof *mode);
   9.198 -    if (mode == NULL) {
   9.199 -        SDL_OutOfMemory();
   9.200 -        return -1;
   9.201 -    }
   9.202 -    mode->x = 0;
   9.203 -    mode->y = 0;
   9.204 -    mode->w = inmode->ModeInfo.Xsize;
   9.205 -    mode->h = inmode->ModeInfo.Ysize;
   9.206 -
   9.207 -    /* Allocate the new list of modes, and fill in the new mode */
   9.208 -    next_mode = SDL_nummodes[index];
   9.209 -    SDL_modelist[index] = (SDL_Rect **)
   9.210 -        SDL_realloc(SDL_modelist[index],
   9.211 -                    (1 + next_mode + 1) * sizeof(SDL_Rect *));
   9.212 -    if (SDL_modelist[index] == NULL) {
   9.213 -        SDL_OutOfMemory();
   9.214 -        SDL_nummodes[index] = 0;
   9.215 -        SDL_free(mode);
   9.216 -        return -1;
   9.217 -    }
   9.218 -    SDL_modelist[index][next_mode] = mode;
   9.219 -    SDL_modelist[index][next_mode + 1] = NULL;
   9.220 -    SDL_nummodes[index]++;
   9.221 -
   9.222 -    return 0;
   9.223 -}
   9.224 -
   9.225 -static void
   9.226 -VGL_UpdateVideoInfo(_THIS)
   9.227 -{
   9.228 -    this->info.wm_available = 0;
   9.229 -    this->info.hw_available = 1;
   9.230 -    this->info.video_mem = 0;
   9.231 -    if (VGLCurMode == NULL) {
   9.232 -        return;
   9.233 -    }
   9.234 -    if (VGLCurMode->ModeInfo.PixelBytes > 0) {
   9.235 -        this->info.video_mem = VGLCurMode->ModeInfo.PixelBytes *
   9.236 -            VGLCurMode->ModeInfo.Xsize * VGLCurMode->ModeInfo.Ysize;
   9.237 -    }
   9.238 -}
   9.239 -
   9.240 -int
   9.241 -VGL_VideoInit(_THIS, SDL_PixelFormat * vformat)
   9.242 -{
   9.243 -    int i;
   9.244 -    int total_modes;
   9.245 -    VGLMode **modes;
   9.246 -
   9.247 -    /* Initialize all variables that we clean on shutdown */
   9.248 -    for (i = 0; i < NUM_MODELISTS; ++i) {
   9.249 -        SDL_nummodes[i] = 0;
   9.250 -        SDL_modelist[i] = NULL;
   9.251 -    }
   9.252 -
   9.253 -    /* Enable mouse and keyboard support */
   9.254 -    if (SDL_getenv("SDL_NO_RAWKBD") == NULL) {
   9.255 -        if (VGLKeyboardInit(VGL_CODEKEYS) != 0) {
   9.256 -            SDL_SetError("Unable to initialize keyboard");
   9.257 -            return -1;
   9.258 -        }
   9.259 -    } else {
   9.260 -        warnx("Requiest to put keyboard into a raw mode ignored");
   9.261 -    }
   9.262 -    if (VGL_initkeymaps(STDIN_FILENO) != 0) {
   9.263 -        SDL_SetError("Unable to initialize keymap");
   9.264 -        return -1;
   9.265 -    }
   9.266 -    if (VGL_initmouse(STDIN_FILENO) != 0) {
   9.267 -        SDL_SetError("Unable to initialize mouse");
   9.268 -        return -1;
   9.269 -    }
   9.270 -
   9.271 -    /* Determine the current screen size */
   9.272 -    if (VGLCurMode != NULL) {
   9.273 -        this->info.current_w = VGLCurMode->ModeInfo.Xsize;
   9.274 -        this->info.current_h = VGLCurMode->ModeInfo.Ysize;
   9.275 -    }
   9.276 -
   9.277 -    /* Determine the screen depth */
   9.278 -    if (VGLCurMode != NULL)
   9.279 -        vformat->BitsPerPixel = VGLCurMode->Depth;
   9.280 -    else
   9.281 -        vformat->BitsPerPixel = 16;     /* Good default */
   9.282 -
   9.283 -    /* Query for the list of available video modes */
   9.284 -    total_modes = 0;
   9.285 -    modes = VGLListModes(-1, V_INFO_MM_DIRECT | V_INFO_MM_PACKED);
   9.286 -    for (i = 0; modes[i] != NULL; i++) {
   9.287 -        if ((modes[i]->ModeInfo.Type == VIDBUF8) ||
   9.288 -            (modes[i]->ModeInfo.Type == VIDBUF16) ||
   9.289 -            (modes[i]->ModeInfo.Type == VIDBUF32)) {
   9.290 -            VGL_AddMode(this, modes[i]);
   9.291 -            total_modes++;
   9.292 -        }
   9.293 -    }
   9.294 -    if (total_modes == 0) {
   9.295 -        SDL_SetError("No linear video modes available");
   9.296 -        return -1;
   9.297 -    }
   9.298 -
   9.299 -    /* Fill in our hardware acceleration capabilities */
   9.300 -    VGL_UpdateVideoInfo(this);
   9.301 -
   9.302 -    /* Create the hardware surface lock mutex */
   9.303 -    hw_lock = SDL_CreateMutex();
   9.304 -    if (hw_lock == NULL) {
   9.305 -        SDL_SetError("Unable to create lock mutex");
   9.306 -        VGL_VideoQuit(this);
   9.307 -        return -1;
   9.308 -    }
   9.309 -
   9.310 -    /* We're done! */
   9.311 -    return 0;
   9.312 -}
   9.313 -
   9.314 -SDL_Rect **
   9.315 -VGL_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
   9.316 -{
   9.317 -    return SDL_modelist[((format->BitsPerPixel + 7) / 8) - 1];
   9.318 -}
   9.319 -
   9.320 -/* Various screen update functions available */
   9.321 -static void VGL_DirectUpdate(_THIS, int numrects, SDL_Rect * rects);
   9.322 -static void VGL_BankedUpdate(_THIS, int numrects, SDL_Rect * rects);
   9.323 -
   9.324 -SDL_Surface *
   9.325 -VGL_SetVideoMode(_THIS, SDL_Surface * current,
   9.326 -                 int width, int height, int bpp, Uint32 flags)
   9.327 -{
   9.328 -    int mode_found;
   9.329 -    int i;
   9.330 -    VGLMode **modes;
   9.331 -
   9.332 -    modes = VGLListModes(bpp, V_INFO_MM_DIRECT | V_INFO_MM_PACKED);
   9.333 -    mode_found = 0;
   9.334 -    for (i = 0; modes[i] != NULL; i++) {
   9.335 -        if ((modes[i]->ModeInfo.Xsize == width) &&
   9.336 -            (modes[i]->ModeInfo.Ysize == height) &&
   9.337 -            ((modes[i]->ModeInfo.Type == VIDBUF8) ||
   9.338 -             (modes[i]->ModeInfo.Type == VIDBUF16) ||
   9.339 -             (modes[i]->ModeInfo.Type == VIDBUF32))) {
   9.340 -            mode_found = 1;
   9.341 -            break;
   9.342 -        }
   9.343 -    }
   9.344 -    if (mode_found == 0) {
   9.345 -        SDL_SetError("No matching video mode found");
   9.346 -        return NULL;
   9.347 -    }
   9.348 -
   9.349 -    /* Shutdown previous videomode (if any) */
   9.350 -    if (VGLCurMode != NULL)
   9.351 -        VGLEnd();
   9.352 -
   9.353 -    /* Try to set the requested linear video mode */
   9.354 -    if (VGLInit(modes[i]->ModeId) != 0) {
   9.355 -        SDL_SetError("Unable to switch to requested mode");
   9.356 -        return NULL;
   9.357 -    }
   9.358 -
   9.359 -    VGLCurMode = SDL_realloc(VGLCurMode, sizeof(VGLMode));
   9.360 -    VGLCurMode->ModeInfo = *VGLDisplay;
   9.361 -    VGLCurMode->Depth = modes[i]->Depth;
   9.362 -    VGLCurMode->ModeId = modes[i]->ModeId;
   9.363 -    VGLCurMode->Rmask = modes[i]->Rmask;
   9.364 -    VGLCurMode->Gmask = modes[i]->Gmask;
   9.365 -    VGLCurMode->Bmask = modes[i]->Bmask;
   9.366 -
   9.367 -    /* Workaround a bug in libvgl */
   9.368 -    if (VGLCurMode->ModeInfo.PixelBytes == 0)
   9.369 -        (VGLCurMode->ModeInfo.PixelBytes = 1);
   9.370 -
   9.371 -    current->w = VGLCurMode->ModeInfo.Xsize;
   9.372 -    current->h = VGLCurMode->ModeInfo.Ysize;
   9.373 -    current->pixels = VGLCurMode->ModeInfo.Bitmap;
   9.374 -    current->pitch = VGLCurMode->ModeInfo.Xsize *
   9.375 -        VGLCurMode->ModeInfo.PixelBytes;
   9.376 -    current->flags = (SDL_FULLSCREEN | SDL_HWSURFACE);
   9.377 -
   9.378 -    /* Check if we are in a pseudo-color mode */
   9.379 -    if (VGLCurMode->ModeInfo.Type == VIDBUF8)
   9.380 -        current->flags |= SDL_HWPALETTE;
   9.381 -
   9.382 -    /* Check if we can do doublebuffering */
   9.383 -    if (flags & SDL_DOUBLEBUF) {
   9.384 -        if (VGLCurMode->ModeInfo.Xsize * 2 <= VGLCurMode->ModeInfo.VYsize) {
   9.385 -            current->flags |= SDL_DOUBLEBUF;
   9.386 -            flip_page = 0;
   9.387 -            flip_address[0] = (byte *) current->pixels;
   9.388 -            flip_address[1] = (byte *) current->pixels +
   9.389 -                current->h * current->pitch;
   9.390 -            VGL_FlipHWSurface(this, current);
   9.391 -        }
   9.392 -    }
   9.393 -
   9.394 -    if (!SDL_ReallocFormat(current, modes[i]->Depth, VGLCurMode->Rmask,
   9.395 -                           VGLCurMode->Gmask, VGLCurMode->Bmask, 0)) {
   9.396 -        return NULL;
   9.397 -    }
   9.398 -
   9.399 -    /* Update hardware acceleration info */
   9.400 -    VGL_UpdateVideoInfo(this);
   9.401 -
   9.402 -    /* Set the blit function */
   9.403 -    this->UpdateRects = VGL_DirectUpdate;
   9.404 -
   9.405 -    /* We're done */
   9.406 -    return current;
   9.407 -}
   9.408 -
   9.409 -/* We don't actually allow hardware surfaces other than the main one */
   9.410 -static int
   9.411 -VGL_AllocHWSurface(_THIS, SDL_Surface * surface)
   9.412 -{
   9.413 -    return -1;
   9.414 -}
   9.415 -
   9.416 -static void
   9.417 -VGL_FreeHWSurface(_THIS, SDL_Surface * surface)
   9.418 -{
   9.419 -    return;
   9.420 -}
   9.421 -
   9.422 -/* We need to wait for vertical retrace on page flipped displays */
   9.423 -static int
   9.424 -VGL_LockHWSurface(_THIS, SDL_Surface * surface)
   9.425 -{
   9.426 -    if (surface == SDL_VideoSurface) {
   9.427 -        SDL_mutexP(hw_lock);
   9.428 -    }
   9.429 -    return 0;
   9.430 -}
   9.431 -
   9.432 -static void
   9.433 -VGL_UnlockHWSurface(_THIS, SDL_Surface * surface)
   9.434 -{
   9.435 -    if (surface == SDL_VideoSurface) {
   9.436 -        SDL_mutexV(hw_lock);
   9.437 -    }
   9.438 -}
   9.439 -
   9.440 -static int
   9.441 -VGL_FlipHWSurface(_THIS, SDL_Surface * surface)
   9.442 -{
   9.443 -//      VGLWaitRetrace();
   9.444 -    if (VGLPanScreen(VGLDisplay, 0, flip_page * surface->h) < 0) {
   9.445 -        SDL_SetError("VGLPanSreen() failed");
   9.446 -        return -1;
   9.447 -    }
   9.448 -
   9.449 -    flip_page = !flip_page;
   9.450 -    surface->pixels = flip_address[flip_page];
   9.451 -
   9.452 -    return 0;
   9.453 -}
   9.454 -
   9.455 -static void
   9.456 -VGL_DirectUpdate(_THIS, int numrects, SDL_Rect * rects)
   9.457 -{
   9.458 -    return;
   9.459 -}
   9.460 -
   9.461 -static void
   9.462 -VGL_BankedUpdate(_THIS, int numrects, SDL_Rect * rects)
   9.463 -{
   9.464 -    return;
   9.465 -}
   9.466 -
   9.467 -int
   9.468 -VGL_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   9.469 -{
   9.470 -    int i;
   9.471 -
   9.472 -    for (i = 0; i < ncolors; i++) {
   9.473 -        VGLSetPaletteIndex(firstcolor + i,
   9.474 -                           colors[i].r >> 2,
   9.475 -                           colors[i].g >> 2, colors[i].b >> 2);
   9.476 -    }
   9.477 -    return 1;
   9.478 -}
   9.479 -
   9.480 -/* Note:  If we are terminated, this could be called in the middle of
   9.481 -   another SDL video routine -- notably UpdateRects.
   9.482 -*/
   9.483 -void
   9.484 -VGL_VideoQuit(_THIS)
   9.485 -{
   9.486 -    int i, j;
   9.487 -
   9.488 -    /* Return the keyboard to the normal state */
   9.489 -    VGLKeyboardEnd();
   9.490 -
   9.491 -    /* Reset the console video mode if we actually initialised one */
   9.492 -    if (VGLCurMode != NULL) {
   9.493 -        VGLEnd();
   9.494 -        SDL_free(VGLCurMode);
   9.495 -        VGLCurMode = NULL;
   9.496 -    }
   9.497 -
   9.498 -    /* Clear the lock mutex */
   9.499 -    if (hw_lock != NULL) {
   9.500 -        SDL_DestroyMutex(hw_lock);
   9.501 -        hw_lock = NULL;
   9.502 -    }
   9.503 -
   9.504 -    /* Free video mode lists */
   9.505 -    for (i = 0; i < NUM_MODELISTS; i++) {
   9.506 -        if (SDL_modelist[i] != NULL) {
   9.507 -            for (j = 0; SDL_modelist[i][j] != NULL; ++j) {
   9.508 -                SDL_free(SDL_modelist[i][j]);
   9.509 -            }
   9.510 -            SDL_free(SDL_modelist[i]);
   9.511 -            SDL_modelist[i] = NULL;
   9.512 -        }
   9.513 -    }
   9.514 -
   9.515 -    if (this->screen && (this->screen->flags & SDL_HWSURFACE)) {
   9.516 -        /* Direct screen access, not a memory buffer */
   9.517 -        this->screen->pixels = NULL;
   9.518 -    }
   9.519 -}
   9.520 -
   9.521 -#define VGL_RED_INDEX	0
   9.522 -#define VGL_GREEN_INDEX	1
   9.523 -#define VGL_BLUE_INDEX	2
   9.524 -
   9.525 -static VGLMode **
   9.526 -VGLListModes(int depth, int mem_model)
   9.527 -{
   9.528 -    static VGLMode **modes = NULL;
   9.529 -
   9.530 -    VGLBitmap *vminfop;
   9.531 -    VGLMode **modesp, *modescp;
   9.532 -    video_info_t minfo;
   9.533 -    int adptype, i, modenum;
   9.534 -
   9.535 -    if (modes == NULL) {
   9.536 -        modes = SDL_malloc(sizeof(VGLMode *) * M_VESA_MODE_MAX);
   9.537 -        bzero(modes, sizeof(VGLMode *) * M_VESA_MODE_MAX);
   9.538 -    }
   9.539 -    modesp = modes;
   9.540 -
   9.541 -    for (modenum = 0; modenum < M_VESA_MODE_MAX; modenum++) {
   9.542 -        minfo.vi_mode = modenum;
   9.543 -        if (ioctl(0, CONS_MODEINFO, &minfo)
   9.544 -            || ioctl(0, CONS_CURRENT, &adptype))
   9.545 -            continue;
   9.546 -        if (minfo.vi_mode != modenum)
   9.547 -            continue;
   9.548 -        if ((minfo.vi_flags & V_INFO_GRAPHICS) == 0)
   9.549 -            continue;
   9.550 -        if ((mem_model != -1) && ((minfo.vi_mem_model & mem_model) == 0))
   9.551 -            continue;
   9.552 -        if ((depth > 1) && (minfo.vi_depth != depth))
   9.553 -            continue;
   9.554 -
   9.555 -        /* reallocf can fail */
   9.556 -        if ((*modesp = reallocf(*modesp, sizeof(VGLMode))) == NULL)
   9.557 -            return NULL;
   9.558 -        modescp = *modesp;
   9.559 -
   9.560 -        vminfop = &(modescp->ModeInfo);
   9.561 -        bzero(vminfop, sizeof(VGLBitmap));
   9.562 -
   9.563 -        vminfop->Type = NOBUF;
   9.564 -
   9.565 -        vminfop->PixelBytes = 1;        /* Good default value */
   9.566 -        switch (minfo.vi_mem_model) {
   9.567 -        case V_INFO_MM_PLANAR:
   9.568 -            /* we can handle EGA/VGA planar modes only */
   9.569 -            if (!(minfo.vi_depth != 4 || minfo.vi_planes != 4
   9.570 -                  || (adptype != KD_EGA && adptype != KD_VGA)))
   9.571 -                vminfop->Type = VIDBUF4;
   9.572 -            break;
   9.573 -        case V_INFO_MM_PACKED:
   9.574 -            /* we can do only 256 color packed modes */
   9.575 -            if (minfo.vi_depth == 8)
   9.576 -                vminfop->Type = VIDBUF8;
   9.577 -            break;
   9.578 -        case V_INFO_MM_VGAX:
   9.579 -            vminfop->Type = VIDBUF8X;
   9.580 -            break;
   9.581 -#if defined(__FREEBSD__) && (defined(__DragonFly__) || __FreeBSD_version >= 500000)
   9.582 -        case V_INFO_MM_DIRECT:
   9.583 -            vminfop->PixelBytes = minfo.vi_pixel_size;
   9.584 -            switch (vminfop->PixelBytes) {
   9.585 -            case 2:
   9.586 -                vminfop->Type = VIDBUF16;
   9.587 -                break;
   9.588 -#if notyet
   9.589 -            case 3:
   9.590 -                vminfop->Type = VIDBUF24;
   9.591 -                break;
   9.592 -#endif
   9.593 -            case 4:
   9.594 -                vminfop->Type = VIDBUF32;
   9.595 -                break;
   9.596 -            default:
   9.597 -                break;
   9.598 -            }
   9.599 -#endif
   9.600 -        default:
   9.601 -            break;
   9.602 -        }
   9.603 -        if (vminfop->Type == NOBUF)
   9.604 -            continue;
   9.605 -
   9.606 -        switch (vminfop->Type) {
   9.607 -        case VIDBUF16:
   9.608 -        case VIDBUF32:
   9.609 -            modescp->Rmask =
   9.610 -                ((1 << minfo.vi_pixel_fsizes[VGL_RED_INDEX]) -
   9.611 -                 1) << minfo.vi_pixel_fields[VGL_RED_INDEX];
   9.612 -            modescp->Gmask =
   9.613 -                ((1 << minfo.vi_pixel_fsizes[VGL_GREEN_INDEX]) -
   9.614 -                 1) << minfo.vi_pixel_fields[VGL_GREEN_INDEX];
   9.615 -            modescp->Bmask =
   9.616 -                ((1 << minfo.vi_pixel_fsizes[VGL_BLUE_INDEX]) -
   9.617 -                 1) << minfo.vi_pixel_fields[VGL_BLUE_INDEX];
   9.618 -            break;
   9.619 -
   9.620 -        default:
   9.621 -            break;
   9.622 -        }
   9.623 -
   9.624 -        vminfop->Xsize = minfo.vi_width;
   9.625 -        vminfop->Ysize = minfo.vi_height;
   9.626 -        modescp->Depth = minfo.vi_depth;
   9.627 -
   9.628 -        /* XXX */
   9.629 -        if (minfo.vi_mode >= M_VESA_BASE)
   9.630 -            modescp->ModeId = _IO('V', minfo.vi_mode - M_VESA_BASE);
   9.631 -        else
   9.632 -            modescp->ModeId = _IO('S', minfo.vi_mode);
   9.633 -
   9.634 -        /* Sort list */
   9.635 -        for (i = 0; modes + i < modesp; i++) {
   9.636 -            if (modes[i]->ModeInfo.Xsize * modes[i]->ModeInfo.Ysize >
   9.637 -                vminfop->Xsize * modes[i]->ModeInfo.Ysize)
   9.638 -                continue;
   9.639 -            if ((modes[i]->ModeInfo.Xsize * modes[i]->ModeInfo.Ysize ==
   9.640 -                 vminfop->Xsize * vminfop->Ysize) &&
   9.641 -                (modes[i]->Depth >= modescp->Depth))
   9.642 -                continue;
   9.643 -            *modesp = modes[i];
   9.644 -            modes[i] = modescp;
   9.645 -            modescp = *modesp;
   9.646 -            vminfop = &(modescp->ModeInfo);
   9.647 -        }
   9.648 -
   9.649 -        modesp++;
   9.650 -    }
   9.651 -
   9.652 -    if (*modesp != NULL) {
   9.653 -        SDL_free(*modesp);
   9.654 -        *modesp = NULL;
   9.655 -    }
   9.656 -
   9.657 -    return modes;
   9.658 -}
   9.659 -
   9.660 -static void
   9.661 -VGLWaitRetrace(void)
   9.662 -{
   9.663 -    while (!(inb(0x3DA) & 8));
   9.664 -    while (inb(0x3DA) & 8);
   9.665 -}
   9.666 -
   9.667 -/* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/video/vgl/SDL_vglvideo.h	Sat Sep 19 07:28:59 2009 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,68 +0,0 @@
    10.4 -/*
    10.5 -    SDL - Simple DirectMedia Layer
    10.6 -    Copyright (C) 1997-2009 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 Lesser General Public
   10.10 -    License as published by the Free Software Foundation; either
   10.11 -    version 2.1 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 -    Lesser General Public License for more details.
   10.17 -
   10.18 -    You should have received a copy of the GNU Lesser General Public
   10.19 -    License along with this library; if not, write to the Free Software
   10.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   10.21 -
   10.22 -    Sam Lantinga
   10.23 -    slouken@libsdl.org
   10.24 -*/
   10.25 -#include "SDL_config.h"
   10.26 -
   10.27 -#ifndef _SDL_vglvideo_h
   10.28 -#define _SDL_vglvideo_h
   10.29 -
   10.30 -#include <sys/fbio.h>
   10.31 -#include <sys/consio.h>
   10.32 -#include <vgl.h>
   10.33 -
   10.34 -#include "SDL_mouse.h"
   10.35 -#include "SDL_mutex.h"
   10.36 -#include "../SDL_sysvideo.h"
   10.37 -
   10.38 -/* Hidden "this" pointer for the video functions */
   10.39 -#define _THIS	SDL_VideoDevice *this
   10.40 -
   10.41 -typedef struct
   10.42 -{
   10.43 -    int ModeId;
   10.44 -    int Depth;
   10.45 -    int Rmask;
   10.46 -    int Gmask;
   10.47 -    int Bmask;
   10.48 -    VGLBitmap ModeInfo;
   10.49 -} VGLMode;
   10.50 -
   10.51 -/* Private display data */
   10.52 -struct SDL_PrivateVideoData
   10.53 -{
   10.54 -#define NUM_MODELISTS	4       /* 8, 16, 24, and 32 bits-per-pixel */
   10.55 -    int SDL_nummodes[NUM_MODELISTS];
   10.56 -    SDL_Rect **SDL_modelist[NUM_MODELISTS];
   10.57 -    SDL_mutex *hw_lock;
   10.58 -    VGLMode *VGLCurMode;
   10.59 -    int flip_page;
   10.60 -    byte *flip_address[2];
   10.61 -};
   10.62 -/* Old variable names */
   10.63 -#define SDL_nummodes	(this->hidden->SDL_nummodes)
   10.64 -#define SDL_modelist	(this->hidden->SDL_modelist)
   10.65 -#define hw_lock		(this->hidden->hw_lock)
   10.66 -#define VGLCurMode	(this->hidden->VGLCurMode)
   10.67 -#define flip_page	(this->hidden->flip_page)
   10.68 -#define flip_address	(this->hidden->flip_address)
   10.69 -
   10.70 -#endif /* _SDL_vglvideo_h */
   10.71 -/* vi: set ts=4 sw=4 expandtab: */