Nobody has stepped up to maintain an svgalib driver. Bye bye! :)
authorSam Lantinga <slouken@libsdl.org>
Wed, 19 Jan 2011 22:21:31 -0800
changeset 5047edaf3e364a05
parent 5046 4cb778067834
child 5048 187d7d446306
Nobody has stepped up to maintain an svgalib driver. Bye bye! :)
SDL.spec.in
configure.in
include/SDL_config.h.in
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/svga/SDL_svgaevents.c
src/video/svga/SDL_svgaevents_c.h
src/video/svga/SDL_svgamouse.c
src/video/svga/SDL_svgamouse_c.h
src/video/svga/SDL_svgavideo.c
src/video/svga/SDL_svgavideo.h
     1.1 --- a/SDL.spec.in	Wed Jan 19 22:20:44 2011 -0800
     1.2 +++ b/SDL.spec.in	Wed Jan 19 22:21:31 2011 -0800
     1.3 @@ -39,7 +39,7 @@
     1.4  
     1.5  %build
     1.6  %ifos linux
     1.7 -CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga
     1.8 +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-directfb
     1.9  %else
    1.10  %configure
    1.11  %endif
     2.1 --- a/configure.in	Wed Jan 19 22:20:44 2011 -0800
     2.2 +++ b/configure.in	Wed Jan 19 22:21:31 2011 -0800
     2.3 @@ -1586,36 +1586,6 @@
     2.4    fi
     2.5  }
     2.6  
     2.7 -dnl Find the SVGAlib includes and libraries
     2.8 -CheckSVGA()
     2.9 -{
    2.10 -    AC_ARG_ENABLE(video-svga,
    2.11 -AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=no]]]),
    2.12 -                  , enable_video_svga=no)
    2.13 -    if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
    2.14 -        AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
    2.15 -        video_svga=no
    2.16 -        AC_TRY_COMPILE([
    2.17 -         #include <vga.h>
    2.18 -         #include <vgamouse.h>
    2.19 -         #include <vgakeyboard.h>
    2.20 -        ],[
    2.21 -         if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
    2.22 -             exit(0);
    2.23 -         }
    2.24 -        ],[
    2.25 -        video_svga=yes
    2.26 -        ])
    2.27 -        AC_MSG_RESULT($video_svga)
    2.28 -        if test x$video_svga = xyes; then
    2.29 -            AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
    2.30 -            SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
    2.31 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
    2.32 -            have_video=yes
    2.33 -        fi
    2.34 -    fi
    2.35 -}
    2.36 -
    2.37  dnl rcg04172001 Set up the Null video driver.
    2.38  CheckDummyVideo()
    2.39  {
    2.40 @@ -2276,7 +2246,6 @@
    2.41          CheckDirectFB
    2.42          CheckFusionSound
    2.43          CheckPS3
    2.44 -        CheckSVGA
    2.45          CheckOpenGLX11
    2.46          CheckInputEvents
    2.47          CheckTslib
     3.1 --- a/include/SDL_config.h.in	Wed Jan 19 22:20:44 2011 -0800
     3.2 +++ b/include/SDL_config.h.in	Wed Jan 19 22:21:31 2011 -0800
     3.3 @@ -266,7 +266,6 @@
     3.4  #undef SDL_VIDEO_DRIVER_QNXGF
     3.5  #undef SDL_VIDEO_DRIVER_PS3
     3.6  #undef SDL_VIDEO_DRIVER_RISCOS
     3.7 -#undef SDL_VIDEO_DRIVER_SVGALIB
     3.8  #undef SDL_VIDEO_DRIVER_WIN32
     3.9  #undef SDL_VIDEO_DRIVER_X11
    3.10  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
     4.1 --- a/src/video/SDL_sysvideo.h	Wed Jan 19 22:20:44 2011 -0800
     4.2 +++ b/src/video/SDL_sysvideo.h	Wed Jan 19 22:21:31 2011 -0800
     4.3 @@ -414,9 +414,6 @@
     4.4  #if SDL_VIDEO_DRIVER_PS3
     4.5  extern VideoBootStrap PS3_bootstrap;
     4.6  #endif
     4.7 -#if SDL_VIDEO_DRIVER_SVGALIB
     4.8 -extern VideoBootStrap SVGALIB_bootstrap;
     4.9 -#endif
    4.10  #if SDL_VIDEO_DRIVER_WIN32
    4.11  extern VideoBootStrap WIN32_bootstrap;
    4.12  #endif
     5.1 --- a/src/video/SDL_video.c	Wed Jan 19 22:20:44 2011 -0800
     5.2 +++ b/src/video/SDL_video.c	Wed Jan 19 22:21:31 2011 -0800
     5.3 @@ -68,9 +68,6 @@
     5.4  #if SDL_VIDEO_DRIVER_PS3
     5.5      &PS3_bootstrap,
     5.6  #endif
     5.7 -#if SDL_VIDEO_DRIVER_SVGALIB
     5.8 -    &SVGALIB_bootstrap,
     5.9 -#endif
    5.10  #if SDL_VIDEO_DRIVER_WIN32
    5.11      &WIN32_bootstrap,
    5.12  #endif
     6.1 --- a/src/video/svga/SDL_svgaevents.c	Wed Jan 19 22:20:44 2011 -0800
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,420 +0,0 @@
     6.4 -/*
     6.5 -    SDL - Simple DirectMedia Layer
     6.6 -    Copyright (C) 1997-2010 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 -/* Handle the event stream, converting X11 events into SDL events */
    6.28 -
    6.29 -#include <vga.h>
    6.30 -#include <vgamouse.h>
    6.31 -#include <vgakeyboard.h>
    6.32 -#if defined(__LINUX__)
    6.33 -#include <linux/kd.h>
    6.34 -#include <linux/keyboard.h>
    6.35 -#elif defined(__FREEBSD__)
    6.36 -#include <sys/kbio.h>
    6.37 -#else
    6.38 -#error You must choose your operating system here
    6.39 -#endif
    6.40 -
    6.41 -#include "../../events/SDL_sysevents.h"
    6.42 -#include "../../events/SDL_events_c.h"
    6.43 -#include "SDL_svgavideo.h"
    6.44 -#include "SDL_svgaevents_c.h"
    6.45 -
    6.46 -/* The translation tables from a console scancode to a SDL keysym */
    6.47 -#if defined(linux)
    6.48 -#define NUM_VGAKEYMAPS	(1<<KG_CAPSSHIFT)
    6.49 -static Uint16 vga_keymap[NUM_VGAKEYMAPS][NR_KEYS];
    6.50 -#elif defined(__FREEBSD__)
    6.51 -/* FIXME: Free the keymap when we shut down the video mode */
    6.52 -static keymap_t *vga_keymap = NULL;
    6.53 -#else
    6.54 -#error You must choose your operating system here
    6.55 -#endif
    6.56 -static SDLKey keymap[128];
    6.57 -static SDL_keysym *TranslateKey(int scancode, SDL_keysym * keysym);
    6.58 -
    6.59 -/* Ugh, we have to duplicate the kernel's keysym mapping code...
    6.60 -   Oh, it's not so bad. :-)
    6.61 -
    6.62 -   FIXME: Add keyboard LED handling code
    6.63 - */
    6.64 -#if defined(linux)
    6.65 -int
    6.66 -SVGA_initkeymaps(int fd)
    6.67 -{
    6.68 -    struct kbentry entry;
    6.69 -    int map, i;
    6.70 -
    6.71 -    /* Load all the keysym mappings */
    6.72 -    for (map = 0; map < NUM_VGAKEYMAPS; ++map) {
    6.73 -        SDL_memset(vga_keymap[map], 0, NR_KEYS * sizeof(Uint16));
    6.74 -        for (i = 0; i < NR_KEYS; ++i) {
    6.75 -            entry.kb_table = map;
    6.76 -            entry.kb_index = i;
    6.77 -            if (ioctl(fd, KDGKBENT, &entry) == 0) {
    6.78 -                /* The "Enter" key is a special case */
    6.79 -                if (entry.kb_value == K_ENTER) {
    6.80 -                    entry.kb_value = K(KT_ASCII, 13);
    6.81 -                }
    6.82 -                /* Handle numpad specially as well */
    6.83 -                if (KTYP(entry.kb_value) == KT_PAD) {
    6.84 -                    switch (entry.kb_value) {
    6.85 -                    case K_P0:
    6.86 -                    case K_P1:
    6.87 -                    case K_P2:
    6.88 -                    case K_P3:
    6.89 -                    case K_P4:
    6.90 -                    case K_P5:
    6.91 -                    case K_P6:
    6.92 -                    case K_P7:
    6.93 -                    case K_P8:
    6.94 -                    case K_P9:
    6.95 -                        vga_keymap[map][i] = entry.kb_value;
    6.96 -                        vga_keymap[map][i] += '0';
    6.97 -                        break;
    6.98 -                    case K_PPLUS:
    6.99 -                        vga_keymap[map][i] = K(KT_ASCII, '+');
   6.100 -                        break;
   6.101 -                    case K_PMINUS:
   6.102 -                        vga_keymap[map][i] = K(KT_ASCII, '-');
   6.103 -                        break;
   6.104 -                    case K_PSTAR:
   6.105 -                        vga_keymap[map][i] = K(KT_ASCII, '*');
   6.106 -                        break;
   6.107 -                    case K_PSLASH:
   6.108 -                        vga_keymap[map][i] = K(KT_ASCII, '/');
   6.109 -                        break;
   6.110 -                    case K_PENTER:
   6.111 -                        vga_keymap[map][i] = K(KT_ASCII, '\r');
   6.112 -                        break;
   6.113 -                    case K_PCOMMA:
   6.114 -                        vga_keymap[map][i] = K(KT_ASCII, ',');
   6.115 -                        break;
   6.116 -                    case K_PDOT:
   6.117 -                        vga_keymap[map][i] = K(KT_ASCII, '.');
   6.118 -                        break;
   6.119 -                    default:
   6.120 -                        break;
   6.121 -                    }
   6.122 -                }
   6.123 -                /* Do the normal key translation */
   6.124 -                if ((KTYP(entry.kb_value) == KT_LATIN) ||
   6.125 -                    (KTYP(entry.kb_value) == KT_ASCII) ||
   6.126 -                    (KTYP(entry.kb_value) == KT_LETTER)) {
   6.127 -                    vga_keymap[map][i] = entry.kb_value;
   6.128 -                }
   6.129 -            }
   6.130 -        }
   6.131 -    }
   6.132 -    return (0);
   6.133 -}
   6.134 -#elif defined(__FREEBSD__)
   6.135 -int
   6.136 -SVGA_initkeymaps(int fd)
   6.137 -{
   6.138 -    vga_keymap = SDL_malloc(sizeof(keymap_t));
   6.139 -    if (!vga_keymap) {
   6.140 -        SDL_OutOfMemory();
   6.141 -        return (-1);
   6.142 -    }
   6.143 -    if (ioctl(fd, GIO_KEYMAP, vga_keymap) == -1) {
   6.144 -        SDL_free(vga_keymap);
   6.145 -        vga_keymap = NULL;
   6.146 -        SDL_SetError("Unable to get keyboard map");
   6.147 -        return (-1);
   6.148 -    }
   6.149 -    return (0);
   6.150 -}
   6.151 -#else
   6.152 -#error You must choose your operating system here
   6.153 -#endif
   6.154 -
   6.155 -int posted = 0;
   6.156 -
   6.157 -void
   6.158 -SVGA_mousecallback(int button, int dx, int dy, int u1, int u2, int u3, int u4)
   6.159 -{
   6.160 -    if (dx || dy) {
   6.161 -        posted += SDL_PrivateMouseMotion(0, 1, dx, dy);
   6.162 -    }
   6.163 -    if (button & MOUSE_LEFTBUTTON) {
   6.164 -        if (!(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(1))) {
   6.165 -            posted += SDL_PrivateMouseButton(SDL_PRESSED, 1, 0, 0);
   6.166 -        }
   6.167 -    } else {
   6.168 -        if ((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(1))) {
   6.169 -            posted += SDL_PrivateMouseButton(SDL_RELEASED, 1, 0, 0);
   6.170 -        }
   6.171 -    }
   6.172 -    if (button & MOUSE_MIDDLEBUTTON) {
   6.173 -        if (!(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(2))) {
   6.174 -            posted += SDL_PrivateMouseButton(SDL_PRESSED, 2, 0, 0);
   6.175 -        }
   6.176 -    } else {
   6.177 -        if ((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(2))) {
   6.178 -            posted += SDL_PrivateMouseButton(SDL_RELEASED, 2, 0, 0);
   6.179 -        }
   6.180 -    }
   6.181 -    if (button & MOUSE_RIGHTBUTTON) {
   6.182 -        if (!(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(3))) {
   6.183 -            posted += SDL_PrivateMouseButton(SDL_PRESSED, 3, 0, 0);
   6.184 -        }
   6.185 -    } else {
   6.186 -        if ((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(3))) {
   6.187 -            posted += SDL_PrivateMouseButton(SDL_RELEASED, 3, 0, 0);
   6.188 -        }
   6.189 -    }
   6.190 -}
   6.191 -
   6.192 -void
   6.193 -SVGA_keyboardcallback(int scancode, int pressed)
   6.194 -{
   6.195 -    SDL_keysym keysym;
   6.196 -
   6.197 -    if (pressed) {
   6.198 -        posted += SDL_PrivateKeyboard(SDL_PRESSED,
   6.199 -                                      TranslateKey(scancode, &keysym));
   6.200 -    } else {
   6.201 -        posted += SDL_PrivateKeyboard(SDL_RELEASED,
   6.202 -                                      TranslateKey(scancode, &keysym));
   6.203 -    }
   6.204 -}
   6.205 -
   6.206 -void
   6.207 -SVGA_PumpEvents(_THIS)
   6.208 -{
   6.209 -    do {
   6.210 -        posted = 0;
   6.211 -        mouse_update();
   6.212 -        keyboard_update();
   6.213 -    } while (posted);
   6.214 -}
   6.215 -
   6.216 -void
   6.217 -SVGA_InitOSKeymap(_THIS)
   6.218 -{
   6.219 -    int i;
   6.220 -
   6.221 -    /* Initialize the BeOS key translation table */
   6.222 -    for (i = 0; i < SDL_arraysize(keymap); ++i)
   6.223 -        keymap[i] = SDLK_UNKNOWN;
   6.224 -
   6.225 -    keymap[SCANCODE_ESCAPE] = SDLK_ESCAPE;
   6.226 -    keymap[SCANCODE_1] = SDLK_1;
   6.227 -    keymap[SCANCODE_2] = SDLK_2;
   6.228 -    keymap[SCANCODE_3] = SDLK_3;
   6.229 -    keymap[SCANCODE_4] = SDLK_4;
   6.230 -    keymap[SCANCODE_5] = SDLK_5;
   6.231 -    keymap[SCANCODE_6] = SDLK_6;
   6.232 -    keymap[SCANCODE_7] = SDLK_7;
   6.233 -    keymap[SCANCODE_8] = SDLK_8;
   6.234 -    keymap[SCANCODE_9] = SDLK_9;
   6.235 -    keymap[SCANCODE_0] = SDLK_0;
   6.236 -    keymap[SCANCODE_MINUS] = SDLK_MINUS;
   6.237 -    keymap[SCANCODE_EQUAL] = SDLK_EQUALS;
   6.238 -    keymap[SCANCODE_BACKSPACE] = SDLK_BACKSPACE;
   6.239 -    keymap[SCANCODE_TAB] = SDLK_TAB;
   6.240 -    keymap[SCANCODE_Q] = SDLK_q;
   6.241 -    keymap[SCANCODE_W] = SDLK_w;
   6.242 -    keymap[SCANCODE_E] = SDLK_e;
   6.243 -    keymap[SCANCODE_R] = SDLK_r;
   6.244 -    keymap[SCANCODE_T] = SDLK_t;
   6.245 -    keymap[SCANCODE_Y] = SDLK_y;
   6.246 -    keymap[SCANCODE_U] = SDLK_u;
   6.247 -    keymap[SCANCODE_I] = SDLK_i;
   6.248 -    keymap[SCANCODE_O] = SDLK_o;
   6.249 -    keymap[SCANCODE_P] = SDLK_p;
   6.250 -    keymap[SCANCODE_BRACKET_LEFT] = SDLK_LEFTBRACKET;
   6.251 -    keymap[SCANCODE_BRACKET_RIGHT] = SDLK_RIGHTBRACKET;
   6.252 -    keymap[SCANCODE_ENTER] = SDLK_RETURN;
   6.253 -    keymap[SCANCODE_LEFTCONTROL] = SDLK_LCTRL;
   6.254 -    keymap[SCANCODE_A] = SDLK_a;
   6.255 -    keymap[SCANCODE_S] = SDLK_s;
   6.256 -    keymap[SCANCODE_D] = SDLK_d;
   6.257 -    keymap[SCANCODE_F] = SDLK_f;
   6.258 -    keymap[SCANCODE_G] = SDLK_g;
   6.259 -    keymap[SCANCODE_H] = SDLK_h;
   6.260 -    keymap[SCANCODE_J] = SDLK_j;
   6.261 -    keymap[SCANCODE_K] = SDLK_k;
   6.262 -    keymap[SCANCODE_L] = SDLK_l;
   6.263 -    keymap[SCANCODE_SEMICOLON] = SDLK_SEMICOLON;
   6.264 -    keymap[SCANCODE_APOSTROPHE] = SDLK_QUOTE;
   6.265 -    keymap[SCANCODE_GRAVE] = SDLK_BACKQUOTE;
   6.266 -    keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT;
   6.267 -    keymap[SCANCODE_BACKSLASH] = SDLK_BACKSLASH;
   6.268 -    keymap[SCANCODE_Z] = SDLK_z;
   6.269 -    keymap[SCANCODE_X] = SDLK_x;
   6.270 -    keymap[SCANCODE_C] = SDLK_c;
   6.271 -    keymap[SCANCODE_V] = SDLK_v;
   6.272 -    keymap[SCANCODE_B] = SDLK_b;
   6.273 -    keymap[SCANCODE_N] = SDLK_n;
   6.274 -    keymap[SCANCODE_M] = SDLK_m;
   6.275 -    keymap[SCANCODE_COMMA] = SDLK_COMMA;
   6.276 -    keymap[SCANCODE_PERIOD] = SDLK_PERIOD;
   6.277 -    keymap[SCANCODE_SLASH] = SDLK_SLASH;
   6.278 -    keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT;
   6.279 -    keymap[SCANCODE_KEYPADMULTIPLY] = SDLK_KP_MULTIPLY;
   6.280 -    keymap[SCANCODE_LEFTALT] = SDLK_LALT;
   6.281 -    keymap[SCANCODE_SPACE] = SDLK_SPACE;
   6.282 -    keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
   6.283 -    keymap[SCANCODE_F1] = SDLK_F1;
   6.284 -    keymap[SCANCODE_F2] = SDLK_F2;
   6.285 -    keymap[SCANCODE_F3] = SDLK_F3;
   6.286 -    keymap[SCANCODE_F4] = SDLK_F4;
   6.287 -    keymap[SCANCODE_F5] = SDLK_F5;
   6.288 -    keymap[SCANCODE_F6] = SDLK_F6;
   6.289 -    keymap[SCANCODE_F7] = SDLK_F7;
   6.290 -    keymap[SCANCODE_F8] = SDLK_F8;
   6.291 -    keymap[SCANCODE_F9] = SDLK_F9;
   6.292 -    keymap[SCANCODE_F10] = SDLK_F10;
   6.293 -    keymap[SCANCODE_NUMLOCK] = SDLK_NUMLOCK;
   6.294 -    keymap[SCANCODE_SCROLLLOCK] = SDLK_SCROLLOCK;
   6.295 -    keymap[SCANCODE_KEYPAD7] = SDLK_KP7;
   6.296 -    keymap[SCANCODE_CURSORUPLEFT] = SDLK_KP7;
   6.297 -    keymap[SCANCODE_KEYPAD8] = SDLK_KP8;
   6.298 -    keymap[SCANCODE_CURSORUP] = SDLK_KP8;
   6.299 -    keymap[SCANCODE_KEYPAD9] = SDLK_KP9;
   6.300 -    keymap[SCANCODE_CURSORUPRIGHT] = SDLK_KP9;
   6.301 -    keymap[SCANCODE_KEYPADMINUS] = SDLK_KP_MINUS;
   6.302 -    keymap[SCANCODE_KEYPAD4] = SDLK_KP4;
   6.303 -    keymap[SCANCODE_CURSORLEFT] = SDLK_KP4;
   6.304 -    keymap[SCANCODE_KEYPAD5] = SDLK_KP5;
   6.305 -    keymap[SCANCODE_KEYPAD6] = SDLK_KP6;
   6.306 -    keymap[SCANCODE_CURSORRIGHT] = SDLK_KP6;
   6.307 -    keymap[SCANCODE_KEYPADPLUS] = SDLK_KP_PLUS;
   6.308 -    keymap[SCANCODE_KEYPAD1] = SDLK_KP1;
   6.309 -    keymap[SCANCODE_CURSORDOWNLEFT] = SDLK_KP1;
   6.310 -    keymap[SCANCODE_KEYPAD2] = SDLK_KP2;
   6.311 -    keymap[SCANCODE_CURSORDOWN] = SDLK_KP2;
   6.312 -    keymap[SCANCODE_KEYPAD3] = SDLK_KP3;
   6.313 -    keymap[SCANCODE_CURSORDOWNRIGHT] = SDLK_KP3;
   6.314 -    keymap[SCANCODE_KEYPAD0] = SDLK_KP0;
   6.315 -    keymap[SCANCODE_KEYPADPERIOD] = SDLK_KP_PERIOD;
   6.316 -    keymap[SCANCODE_LESS] = SDLK_LESS;
   6.317 -    keymap[SCANCODE_F11] = SDLK_F11;
   6.318 -    keymap[SCANCODE_F12] = SDLK_F12;
   6.319 -    keymap[SCANCODE_KEYPADENTER] = SDLK_KP_ENTER;
   6.320 -    keymap[SCANCODE_RIGHTCONTROL] = SDLK_RCTRL;
   6.321 -    keymap[SCANCODE_CONTROL] = SDLK_RCTRL;
   6.322 -    keymap[SCANCODE_KEYPADDIVIDE] = SDLK_KP_DIVIDE;
   6.323 -    keymap[SCANCODE_PRINTSCREEN] = SDLK_PRINT;
   6.324 -    keymap[SCANCODE_RIGHTALT] = SDLK_RALT;
   6.325 -    keymap[SCANCODE_BREAK] = SDLK_BREAK;
   6.326 -    keymap[SCANCODE_BREAK_ALTERNATIVE] = SDLK_UNKNOWN;
   6.327 -    keymap[SCANCODE_HOME] = SDLK_HOME;
   6.328 -    keymap[SCANCODE_CURSORBLOCKUP] = SDLK_UP;
   6.329 -    keymap[SCANCODE_PAGEUP] = SDLK_PAGEUP;
   6.330 -    keymap[SCANCODE_CURSORBLOCKLEFT] = SDLK_LEFT;
   6.331 -    keymap[SCANCODE_CURSORBLOCKRIGHT] = SDLK_RIGHT;
   6.332 -    keymap[SCANCODE_END] = SDLK_END;
   6.333 -    keymap[SCANCODE_CURSORBLOCKDOWN] = SDLK_DOWN;
   6.334 -    keymap[SCANCODE_PAGEDOWN] = SDLK_PAGEDOWN;
   6.335 -    keymap[SCANCODE_INSERT] = SDLK_INSERT;
   6.336 -    keymap[SCANCODE_REMOVE] = SDLK_DELETE;
   6.337 -    keymap[119] = SDLK_PAUSE;
   6.338 -    keymap[SCANCODE_RIGHTWIN] = SDLK_RSUPER;
   6.339 -    keymap[SCANCODE_LEFTWIN] = SDLK_LSUPER;
   6.340 -    keymap[127] = SDLK_MENU;
   6.341 -}
   6.342 -
   6.343 -#if defined(linux)
   6.344 -static SDL_keysym *
   6.345 -TranslateKey(int scancode, SDL_keysym * keysym)
   6.346 -{
   6.347 -    /* Set the keysym information */
   6.348 -    keysym->scancode = scancode;
   6.349 -    keysym->sym = keymap[scancode];
   6.350 -    keysym->mod = KMOD_NONE;
   6.351 -
   6.352 -    /* If UNICODE is on, get the UNICODE value for the key */
   6.353 -    keysym->unicode = 0;
   6.354 -    if (SDL_TranslateUNICODE) {
   6.355 -        int map;
   6.356 -        SDLMod modstate;
   6.357 -
   6.358 -        modstate = SDL_GetModState();
   6.359 -        map = 0;
   6.360 -        if (modstate & KMOD_SHIFT) {
   6.361 -            map |= (1 << KG_SHIFT);
   6.362 -        }
   6.363 -        if (modstate & KMOD_CTRL) {
   6.364 -            map |= (1 << KG_CTRL);
   6.365 -        }
   6.366 -        if (modstate & KMOD_ALT) {
   6.367 -            map |= (1 << KG_ALT);
   6.368 -        }
   6.369 -        if (modstate & KMOD_MODE) {
   6.370 -            map |= (1 << KG_ALTGR);
   6.371 -        }
   6.372 -        if (KTYP(vga_keymap[map][scancode]) == KT_LETTER) {
   6.373 -            if (modstate & KMOD_CAPS) {
   6.374 -                map ^= (1 << KG_SHIFT);
   6.375 -            }
   6.376 -        }
   6.377 -        if (KTYP(vga_keymap[map][scancode]) == KT_PAD) {
   6.378 -            if (modstate & KMOD_NUM) {
   6.379 -                keysym->unicode = KVAL(vga_keymap[map][scancode]);
   6.380 -            }
   6.381 -        } else {
   6.382 -            keysym->unicode = KVAL(vga_keymap[map][scancode]);
   6.383 -        }
   6.384 -    }
   6.385 -    return (keysym);
   6.386 -}
   6.387 -#elif defined(__FREEBSD__)
   6.388 -static SDL_keysym *
   6.389 -TranslateKey(int scancode, SDL_keysym * keysym)
   6.390 -{
   6.391 -    /* Set the keysym information */
   6.392 -    keysym->scancode = scancode;
   6.393 -    keysym->sym = keymap[scancode];
   6.394 -    keysym->mod = KMOD_NONE;
   6.395 -
   6.396 -    /* If UNICODE is on, get the UNICODE value for the key */
   6.397 -    keysym->unicode = 0;
   6.398 -    if (SDL_TranslateUNICODE && vga_keymap) {
   6.399 -        int map;
   6.400 -        SDLMod modstate;
   6.401 -
   6.402 -        modstate = SDL_GetModState();
   6.403 -        map = 0;
   6.404 -        if (modstate & KMOD_SHIFT) {
   6.405 -            map += 1;
   6.406 -        }
   6.407 -        if (modstate & KMOD_CTRL) {
   6.408 -            map += 2;
   6.409 -        }
   6.410 -        if (modstate & KMOD_ALT) {
   6.411 -            map += 4;
   6.412 -        }
   6.413 -        if (!(vga_keymap->key[scancode].spcl & (0x80 >> map))) {
   6.414 -            keysym->unicode = vga_keymap->key[scancode].map[map];
   6.415 -        }
   6.416 -
   6.417 -    }
   6.418 -    return (keysym);
   6.419 -}
   6.420 -#else
   6.421 -#error You must choose your operating system here
   6.422 -#endif
   6.423 -/* vi: set ts=4 sw=4 expandtab: */
     7.1 --- a/src/video/svga/SDL_svgaevents_c.h	Wed Jan 19 22:20:44 2011 -0800
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,36 +0,0 @@
     7.4 -/*
     7.5 -    SDL - Simple DirectMedia Layer
     7.6 -    Copyright (C) 1997-2010 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_svgavideo.h"
    7.28 -
    7.29 -/* Variables and functions exported by SDL_sysevents.c to other parts 
    7.30 -   of the native video subsystem (SDL_sysvideo.c)
    7.31 -*/
    7.32 -extern int SVGA_initkeymaps(int fd);
    7.33 -extern void SVGA_mousecallback(int button, int dx, int dy,
    7.34 -                               int u1, int u2, int u3, int u4);
    7.35 -extern void SVGA_keyboardcallback(int scancode, int pressed);
    7.36 -
    7.37 -extern void SVGA_InitOSKeymap(_THIS);
    7.38 -extern void SVGA_PumpEvents(_THIS);
    7.39 -/* vi: set ts=4 sw=4 expandtab: */
     8.1 --- a/src/video/svga/SDL_svgamouse.c	Wed Jan 19 22:20:44 2011 -0800
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,35 +0,0 @@
     8.4 -/*
     8.5 -    SDL - Simple DirectMedia Layer
     8.6 -    Copyright (C) 1997-2010 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_mouse.h"
    8.28 -#include "../../events/SDL_events_c.h"
    8.29 -#include "SDL_svgavideo.h"
    8.30 -#include "SDL_svgamouse_c.h"
    8.31 -
    8.32 -
    8.33 -/* The implementation dependent data for the window manager cursor */
    8.34 -struct WMcursor
    8.35 -{
    8.36 -    int unused;
    8.37 -};
    8.38 -/* vi: set ts=4 sw=4 expandtab: */
     9.1 --- a/src/video/svga/SDL_svgamouse_c.h	Wed Jan 19 22:20:44 2011 -0800
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,27 +0,0 @@
     9.4 -/*
     9.5 -    SDL - Simple DirectMedia Layer
     9.6 -    Copyright (C) 1997-2010 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 -#include "SDL_svgavideo.h"
    9.28 -
    9.29 -/* Functions to be exported */
    9.30 -/* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/video/svga/SDL_svgavideo.c	Wed Jan 19 22:20:44 2011 -0800
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,604 +0,0 @@
    10.4 -/*
    10.5 -    SDL - Simple DirectMedia Layer
    10.6 -    Copyright (C) 1997-2010 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 -/* SVGAlib based SDL video driver implementation.
   10.28 -*/
   10.29 -
   10.30 -#include <unistd.h>
   10.31 -#include <sys/stat.h>
   10.32 -#include <sys/types.h>
   10.33 -#include <sys/ioctl.h>
   10.34 -#include <fcntl.h>
   10.35 -
   10.36 -#if defined(__LINUX__)
   10.37 -#include <linux/vt.h>
   10.38 -#elif defined(__FREEBSD__)
   10.39 -#include <sys/consio.h>
   10.40 -#else
   10.41 -#error You must choose your operating system here
   10.42 -#endif
   10.43 -#include <vga.h>
   10.44 -#include <vgamouse.h>
   10.45 -#include <vgakeyboard.h>
   10.46 -
   10.47 -#include "SDL_video.h"
   10.48 -#include "SDL_mouse.h"
   10.49 -#include "../SDL_sysvideo.h"
   10.50 -#include "../SDL_pixels_c.h"
   10.51 -#include "../../events/SDL_events_c.h"
   10.52 -#include "SDL_svgavideo.h"
   10.53 -#include "SDL_svgaevents_c.h"
   10.54 -#include "SDL_svgamouse_c.h"
   10.55 -
   10.56 -/* Initialization/Query functions */
   10.57 -static int SVGA_VideoInit(_THIS, SDL_PixelFormat * vformat);
   10.58 -static SDL_Rect **SVGA_ListModes(_THIS, SDL_PixelFormat * format,
   10.59 -                                 Uint32 flags);
   10.60 -static SDL_Surface *SVGA_SetVideoMode(_THIS, SDL_Surface * current,
   10.61 -                                      int width, int height, int bpp,
   10.62 -                                      Uint32 flags);
   10.63 -static int SVGA_SetColors(_THIS, int firstcolor, int ncolors,
   10.64 -                          SDL_Color * colors);
   10.65 -static void SVGA_VideoQuit(_THIS);
   10.66 -
   10.67 -/* Hardware surface functions */
   10.68 -static int SVGA_AllocHWSurface(_THIS, SDL_Surface * surface);
   10.69 -static int SVGA_LockHWSurface(_THIS, SDL_Surface * surface);
   10.70 -static int SVGA_FlipHWSurface(_THIS, SDL_Surface * surface);
   10.71 -static void SVGA_UnlockHWSurface(_THIS, SDL_Surface * surface);
   10.72 -static void SVGA_FreeHWSurface(_THIS, SDL_Surface * surface);
   10.73 -
   10.74 -/* SVGAlib driver bootstrap functions */
   10.75 -
   10.76 -static int
   10.77 -SVGA_Available(void)
   10.78 -{
   10.79 -    /* Check to see if we are root and stdin is a virtual console */
   10.80 -    int console;
   10.81 -
   10.82 -    /* SVGALib 1.9.x+ doesn't require root (via /dev/svga) */
   10.83 -    int svgalib2 = -1;
   10.84 -
   10.85 -    /* See if we are connected to a virtual terminal */
   10.86 -    console = STDIN_FILENO;
   10.87 -#if 0                           /* This is no longer needed, SVGAlib can switch consoles for us */
   10.88 -    if (console >= 0) {
   10.89 -        struct stat sb;
   10.90 -        struct vt_mode dummy;
   10.91 -
   10.92 -        if ((fstat(console, &sb) < 0) ||
   10.93 -            (ioctl(console, VT_GETMODE, &dummy) < 0)) {
   10.94 -            console = -1;
   10.95 -        }
   10.96 -    }
   10.97 -#endif /* 0 */
   10.98 -
   10.99 -    /* See if SVGAlib 2.0 is available */
  10.100 -    svgalib2 = open("/dev/svga", O_RDONLY);
  10.101 -    if (svgalib2 != -1) {
  10.102 -        close(svgalib2);
  10.103 -    }
  10.104 -
  10.105 -    return (((svgalib2 != -1) || (geteuid() == 0)) && (console >= 0));
  10.106 -}
  10.107 -
  10.108 -static void
  10.109 -SVGA_DeleteDevice(SDL_VideoDevice * device)
  10.110 -{
  10.111 -    SDL_free(device->hidden);
  10.112 -    SDL_free(device);
  10.113 -}
  10.114 -
  10.115 -static SDL_VideoDevice *
  10.116 -SVGA_CreateDevice(int devindex)
  10.117 -{
  10.118 -    SDL_VideoDevice *device;
  10.119 -
  10.120 -    /* Initialize all variables that we clean on shutdown */
  10.121 -    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
  10.122 -    if (device) {
  10.123 -        SDL_memset(device, 0, (sizeof *device));
  10.124 -        device->hidden = (struct SDL_PrivateVideoData *)
  10.125 -            SDL_malloc((sizeof *device->hidden));
  10.126 -    }
  10.127 -    if ((device == NULL) || (device->hidden == NULL)) {
  10.128 -        SDL_OutOfMemory();
  10.129 -        if (device) {
  10.130 -            SDL_free(device);
  10.131 -        }
  10.132 -        return (0);
  10.133 -    }
  10.134 -    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
  10.135 -
  10.136 -    /* Set the function pointers */
  10.137 -    device->VideoInit = SVGA_VideoInit;
  10.138 -    device->ListModes = SVGA_ListModes;
  10.139 -    device->SetVideoMode = SVGA_SetVideoMode;
  10.140 -    device->SetColors = SVGA_SetColors;
  10.141 -    device->UpdateRects = NULL;
  10.142 -    device->VideoQuit = SVGA_VideoQuit;
  10.143 -    device->AllocHWSurface = SVGA_AllocHWSurface;
  10.144 -    device->CheckHWBlit = NULL;
  10.145 -    device->FillHWRect = NULL;
  10.146 -    device->SetHWColorKey = NULL;
  10.147 -    device->SetHWAlpha = NULL;
  10.148 -    device->LockHWSurface = SVGA_LockHWSurface;
  10.149 -    device->UnlockHWSurface = SVGA_UnlockHWSurface;
  10.150 -    device->FlipHWSurface = SVGA_FlipHWSurface;
  10.151 -    device->FreeHWSurface = SVGA_FreeHWSurface;
  10.152 -    device->SetCaption = NULL;
  10.153 -    device->SetIcon = NULL;
  10.154 -    device->IconifyWindow = NULL;
  10.155 -    device->GrabInput = NULL;
  10.156 -    device->GetWMInfo = NULL;
  10.157 -    device->InitOSKeymap = SVGA_InitOSKeymap;
  10.158 -    device->PumpEvents = SVGA_PumpEvents;
  10.159 -
  10.160 -    device->free = SVGA_DeleteDevice;
  10.161 -
  10.162 -    return device;
  10.163 -}
  10.164 -
  10.165 -VideoBootStrap SVGALIB_bootstrap = {
  10.166 -    "svgalib", "SVGAlib",
  10.167 -    SVGA_Available, SVGA_CreateDevice
  10.168 -};
  10.169 -
  10.170 -static int
  10.171 -SVGA_AddMode(_THIS, int mode, int actually_add)
  10.172 -{
  10.173 -    int i, j;
  10.174 -    vga_modeinfo *modeinfo;
  10.175 -
  10.176 -    modeinfo = vga_getmodeinfo(mode);
  10.177 -
  10.178 -    i = modeinfo->bytesperpixel - 1;
  10.179 -    if (i < 0) {
  10.180 -        return 0;
  10.181 -    }
  10.182 -    if (actually_add) {
  10.183 -        SDL_Rect saved_rect[2];
  10.184 -        int saved_mode[2];
  10.185 -        int b;
  10.186 -
  10.187 -        /* Add the mode, sorted largest to smallest */
  10.188 -        b = 0;
  10.189 -        j = 0;
  10.190 -        while ((SDL_modelist[i][j]->w > modeinfo->width) ||
  10.191 -               (SDL_modelist[i][j]->h > modeinfo->height)) {
  10.192 -            ++j;
  10.193 -        }
  10.194 -        /* Skip modes that are already in our list */
  10.195 -        if ((SDL_modelist[i][j]->w == modeinfo->width) &&
  10.196 -            (SDL_modelist[i][j]->h == modeinfo->height)) {
  10.197 -            return (0);
  10.198 -        }
  10.199 -        /* Insert the new mode */
  10.200 -        saved_rect[b] = *SDL_modelist[i][j];
  10.201 -        saved_mode[b] = SDL_vgamode[i][j];
  10.202 -        SDL_modelist[i][j]->w = modeinfo->width;
  10.203 -        SDL_modelist[i][j]->h = modeinfo->height;
  10.204 -        SDL_vgamode[i][j] = mode;
  10.205 -        /* Everybody scoot down! */
  10.206 -        if (saved_rect[b].w && saved_rect[b].h) {
  10.207 -            for (++j; SDL_modelist[i][j]->w; ++j) {
  10.208 -                saved_rect[!b] = *SDL_modelist[i][j];
  10.209 -                saved_mode[!b] = SDL_vgamode[i][j];
  10.210 -                *SDL_modelist[i][j] = saved_rect[b];
  10.211 -                SDL_vgamode[i][j] = saved_mode[b];
  10.212 -                b = !b;
  10.213 -            }
  10.214 -            *SDL_modelist[i][j] = saved_rect[b];
  10.215 -            SDL_vgamode[i][j] = saved_mode[b];
  10.216 -        }
  10.217 -    } else {
  10.218 -        ++SDL_nummodes[i];
  10.219 -    }
  10.220 -    return (1);
  10.221 -}
  10.222 -
  10.223 -static void
  10.224 -SVGA_UpdateVideoInfo(_THIS)
  10.225 -{
  10.226 -    vga_modeinfo *modeinfo;
  10.227 -
  10.228 -    this->info.wm_available = 0;
  10.229 -    this->info.hw_available = (banked ? 0 : 1);
  10.230 -    modeinfo = vga_getmodeinfo(vga_getcurrentmode());
  10.231 -    this->info.video_mem = modeinfo->memory;
  10.232 -    /* FIXME: Add hardware accelerated blit information */
  10.233 -#ifdef SVGALIB_DEBUG
  10.234 -    printf("Hardware accelerated blit: %savailable\n",
  10.235 -           modeinfo->haveblit ? "" : "not ");
  10.236 -#endif
  10.237 -}
  10.238 -
  10.239 -int
  10.240 -SVGA_VideoInit(_THIS, SDL_PixelFormat * vformat)
  10.241 -{
  10.242 -    int keyboard;
  10.243 -    int i, j;
  10.244 -    int mode, total_modes;
  10.245 -
  10.246 -    /* Initialize all variables that we clean on shutdown */
  10.247 -    for (i = 0; i < NUM_MODELISTS; ++i) {
  10.248 -        SDL_nummodes[i] = 0;
  10.249 -        SDL_modelist[i] = NULL;
  10.250 -        SDL_vgamode[i] = NULL;
  10.251 -    }
  10.252 -
  10.253 -    /* Initialize the library */
  10.254 -    vga_disabledriverreport();
  10.255 -    if (vga_init() < 0) {
  10.256 -        SDL_SetError("Unable to initialize SVGAlib");
  10.257 -        return (-1);
  10.258 -    }
  10.259 -    vga_setmode(TEXT);
  10.260 -
  10.261 -    /* Enable mouse and keyboard support */
  10.262 -    vga_setmousesupport(1);
  10.263 -    keyboard = keyboard_init_return_fd();
  10.264 -    if (keyboard < 0) {
  10.265 -        SDL_SetError("Unable to initialize keyboard");
  10.266 -        return (-1);
  10.267 -    }
  10.268 -    if (SVGA_initkeymaps(keyboard) < 0) {
  10.269 -        return (-1);
  10.270 -    }
  10.271 -    keyboard_seteventhandler(SVGA_keyboardcallback);
  10.272 -
  10.273 -    /* Determine the current screen size */
  10.274 -    this->info.current_w = 0;
  10.275 -    this->info.current_h = 0;
  10.276 -
  10.277 -    /* Determine the screen depth (use default 8-bit depth) */
  10.278 -    vformat->BitsPerPixel = 8;
  10.279 -
  10.280 -    /* Enumerate the available fullscreen modes */
  10.281 -    total_modes = 0;
  10.282 -    for (mode = vga_lastmodenumber(); mode; --mode) {
  10.283 -        if (vga_hasmode(mode)) {
  10.284 -            if (SVGA_AddMode(this, mode, 0)) {
  10.285 -                ++total_modes;
  10.286 -            }
  10.287 -        }
  10.288 -    }
  10.289 -    if (SVGA_AddMode(this, G320x200x256, 0))
  10.290 -        ++total_modes;
  10.291 -    if (total_modes == 0) {
  10.292 -        SDL_SetError("No linear video modes available");
  10.293 -        return (-1);
  10.294 -    }
  10.295 -    for (i = 0; i < NUM_MODELISTS; ++i) {
  10.296 -        SDL_vgamode[i] = (int *) SDL_malloc(SDL_nummodes[i] * sizeof(int));
  10.297 -        if (SDL_vgamode[i] == NULL) {
  10.298 -            SDL_OutOfMemory();
  10.299 -            return (-1);
  10.300 -        }
  10.301 -        SDL_modelist[i] = (SDL_Rect **)
  10.302 -            SDL_malloc((SDL_nummodes[i] + 1) * sizeof(SDL_Rect *));
  10.303 -        if (SDL_modelist[i] == NULL) {
  10.304 -            SDL_OutOfMemory();
  10.305 -            return (-1);
  10.306 -        }
  10.307 -        for (j = 0; j < SDL_nummodes[i]; ++j) {
  10.308 -            SDL_modelist[i][j] = (SDL_Rect *) SDL_malloc(sizeof(SDL_Rect));
  10.309 -            if (SDL_modelist[i][j] == NULL) {
  10.310 -                SDL_OutOfMemory();
  10.311 -                return (-1);
  10.312 -            }
  10.313 -            SDL_memset(SDL_modelist[i][j], 0, sizeof(SDL_Rect));
  10.314 -        }
  10.315 -        SDL_modelist[i][j] = NULL;
  10.316 -    }
  10.317 -    for (mode = vga_lastmodenumber(); mode; --mode) {
  10.318 -        if (vga_hasmode(mode)) {
  10.319 -            SVGA_AddMode(this, mode, 1);
  10.320 -        }
  10.321 -    }
  10.322 -    SVGA_AddMode(this, G320x200x256, 1);
  10.323 -
  10.324 -    /* Free extra (duplicated) modes */
  10.325 -    for (i = 0; i < NUM_MODELISTS; ++i) {
  10.326 -        j = 0;
  10.327 -        while (SDL_modelist[i][j] && SDL_modelist[i][j]->w) {
  10.328 -            j++;
  10.329 -        }
  10.330 -        while (SDL_modelist[i][j]) {
  10.331 -            SDL_free(SDL_modelist[i][j]);
  10.332 -            SDL_modelist[i][j] = NULL;
  10.333 -            j++;
  10.334 -        }
  10.335 -    }
  10.336 -
  10.337 -    /* Fill in our hardware acceleration capabilities */
  10.338 -    SVGA_UpdateVideoInfo(this);
  10.339 -
  10.340 -    /* We're done! */
  10.341 -    return (0);
  10.342 -}
  10.343 -
  10.344 -SDL_Rect **
  10.345 -SVGA_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
  10.346 -{
  10.347 -    return (SDL_modelist[((format->BitsPerPixel + 7) / 8) - 1]);
  10.348 -}
  10.349 -
  10.350 -/* Various screen update functions available */
  10.351 -static void SVGA_DirectUpdate(_THIS, int numrects, SDL_Rect * rects);
  10.352 -static void SVGA_BankedUpdate(_THIS, int numrects, SDL_Rect * rects);
  10.353 -
  10.354 -SDL_Surface *
  10.355 -SVGA_SetVideoMode(_THIS, SDL_Surface * current,
  10.356 -                  int width, int height, int bpp, Uint32 flags)
  10.357 -{
  10.358 -    int mode;
  10.359 -    int vgamode;
  10.360 -    vga_modeinfo *modeinfo;
  10.361 -    int screenpage_len;
  10.362 -
  10.363 -    /* Free old pixels if we were in banked mode */
  10.364 -    if (banked && current->pixels) {
  10.365 -        free(current->pixels);
  10.366 -        current->pixels = NULL;
  10.367 -    }
  10.368 -
  10.369 -    /* Try to set the requested linear video mode */
  10.370 -    bpp = (bpp + 7) / 8 - 1;
  10.371 -    for (mode = 0; SDL_modelist[bpp][mode]; ++mode) {
  10.372 -        if ((SDL_modelist[bpp][mode]->w == width) &&
  10.373 -            (SDL_modelist[bpp][mode]->h == height)) {
  10.374 -            break;
  10.375 -        }
  10.376 -    }
  10.377 -    if (SDL_modelist[bpp][mode] == NULL) {
  10.378 -        SDL_SetError("Couldn't find requested mode in list");
  10.379 -        return (NULL);
  10.380 -    }
  10.381 -    vgamode = SDL_vgamode[bpp][mode];
  10.382 -    vga_setmode(vgamode);
  10.383 -    vga_setpage(0);
  10.384 -
  10.385 -    if ((vga_setlinearaddressing() < 0) && (vgamode != G320x200x256)) {
  10.386 -        banked = 1;
  10.387 -    } else {
  10.388 -        banked = 0;
  10.389 -    }
  10.390 -
  10.391 -    modeinfo = vga_getmodeinfo(SDL_vgamode[bpp][mode]);
  10.392 -
  10.393 -    /* Update hardware acceleration info */
  10.394 -    SVGA_UpdateVideoInfo(this);
  10.395 -
  10.396 -    /* Allocate the new pixel format for the screen */
  10.397 -    bpp = (bpp + 1) * 8;
  10.398 -    if ((bpp == 16) && (modeinfo->colors == 32768)) {
  10.399 -        bpp = 15;
  10.400 -    }
  10.401 -    if (!SDL_ReallocFormat(current, bpp, 0, 0, 0, 0)) {
  10.402 -        return (NULL);
  10.403 -    }
  10.404 -
  10.405 -    /* Set up the new mode framebuffer */
  10.406 -    current->flags = SDL_FULLSCREEN;
  10.407 -    if (!banked) {
  10.408 -        current->flags |= SDL_HWSURFACE;
  10.409 -    }
  10.410 -    if (bpp == 8) {
  10.411 -        /* FIXME: What about DirectColor? */
  10.412 -        current->flags |= SDL_HWPALETTE;
  10.413 -    }
  10.414 -    current->w = width;
  10.415 -    current->h = height;
  10.416 -    current->pitch = modeinfo->linewidth;
  10.417 -    if (banked) {
  10.418 -        current->pixels = SDL_malloc(current->h * current->pitch);
  10.419 -        if (!current->pixels) {
  10.420 -            SDL_OutOfMemory();
  10.421 -            return (NULL);
  10.422 -        }
  10.423 -    } else {
  10.424 -        current->pixels = vga_getgraphmem();
  10.425 -    }
  10.426 -
  10.427 -    /* set double-buffering */
  10.428 -    if ((flags & SDL_DOUBLEBUF) && !banked) {
  10.429 -        /* length of one screen page in bytes */
  10.430 -        screenpage_len = current->h * modeinfo->linewidth;
  10.431 -
  10.432 -        /* if start address should be aligned */
  10.433 -        if (modeinfo->linewidth_unit) {
  10.434 -            if (screenpage_len % modeinfo->linewidth_unit) {
  10.435 -                screenpage_len +=
  10.436 -                    modeinfo->linewidth_unit -
  10.437 -                    (screenpage_len % modeinfo->linewidth_unit);
  10.438 -            }
  10.439 -        }
  10.440 -
  10.441 -        /* if we heve enough videomemory =  ak je dost videopamete  */
  10.442 -        if (modeinfo->memory > (screenpage_len * 2 / 1024)) {
  10.443 -            current->flags |= SDL_DOUBLEBUF;
  10.444 -            flip_page = 0;
  10.445 -            flip_offset[0] = 0;
  10.446 -            flip_offset[1] = screenpage_len;
  10.447 -            flip_address[0] = vga_getgraphmem();
  10.448 -            flip_address[1] = flip_address[0] + screenpage_len;
  10.449 -            SVGA_FlipHWSurface(this, current);
  10.450 -        }
  10.451 -    }
  10.452 -
  10.453 -    /* Set the blit function */
  10.454 -    if (banked) {
  10.455 -        this->UpdateRects = SVGA_BankedUpdate;
  10.456 -    } else {
  10.457 -        this->UpdateRects = SVGA_DirectUpdate;
  10.458 -    }
  10.459 -
  10.460 -    /* Set up the mouse handler again (buggy SVGAlib 1.40) */
  10.461 -    mouse_seteventhandler(SVGA_mousecallback);
  10.462 -
  10.463 -    /* We're done */
  10.464 -    return (current);
  10.465 -}
  10.466 -
  10.467 -/* We don't actually allow hardware surfaces other than the main one */
  10.468 -static int
  10.469 -SVGA_AllocHWSurface(_THIS, SDL_Surface * surface)
  10.470 -{
  10.471 -    return (-1);
  10.472 -}
  10.473 -
  10.474 -static void
  10.475 -SVGA_FreeHWSurface(_THIS, SDL_Surface * surface)
  10.476 -{
  10.477 -    return;
  10.478 -}
  10.479 -
  10.480 -/* We need to wait for vertical retrace on page flipped displays */
  10.481 -static int
  10.482 -SVGA_LockHWSurface(_THIS, SDL_Surface * surface)
  10.483 -{
  10.484 -    /* The waiting is done in SVGA_FlipHWSurface() */
  10.485 -    return (0);
  10.486 -}
  10.487 -
  10.488 -static void
  10.489 -SVGA_UnlockHWSurface(_THIS, SDL_Surface * surface)
  10.490 -{
  10.491 -    return;
  10.492 -}
  10.493 -
  10.494 -static int
  10.495 -SVGA_FlipHWSurface(_THIS, SDL_Surface * surface)
  10.496 -{
  10.497 -    if (!banked) {
  10.498 -        vga_setdisplaystart(flip_offset[flip_page]);
  10.499 -        flip_page = !flip_page;
  10.500 -        surface->pixels = flip_address[flip_page];
  10.501 -        vga_waitretrace();
  10.502 -    }
  10.503 -    return (0);
  10.504 -}
  10.505 -
  10.506 -static void
  10.507 -SVGA_DirectUpdate(_THIS, int numrects, SDL_Rect * rects)
  10.508 -{
  10.509 -    return;
  10.510 -}
  10.511 -
  10.512 -static void
  10.513 -SVGA_BankedUpdate(_THIS, int numrects, SDL_Rect * rects)
  10.514 -{
  10.515 -    int i, j;
  10.516 -    SDL_Rect *rect;
  10.517 -    int page, vp;
  10.518 -    int x, y, w, h;
  10.519 -    unsigned char *src;
  10.520 -    unsigned char *dst;
  10.521 -    int bpp = this->screen->format->BytesPerPixel;
  10.522 -    int pitch = this->screen->pitch;
  10.523 -
  10.524 -    dst = vga_getgraphmem();
  10.525 -    for (i = 0; i < numrects; ++i) {
  10.526 -        rect = &rects[i];
  10.527 -        x = rect->x;
  10.528 -        y = rect->y;
  10.529 -        w = rect->w * bpp;
  10.530 -        h = rect->h;
  10.531 -
  10.532 -        vp = y * pitch + x * bpp;
  10.533 -        src = (unsigned char *) this->screen->pixels + vp;
  10.534 -        page = vp >> 16;
  10.535 -        vp &= 0xffff;
  10.536 -        vga_setpage(page);
  10.537 -        for (j = 0; j < h; j++) {
  10.538 -            if (vp + w > 0x10000) {
  10.539 -                if (vp >= 0x10000) {
  10.540 -                    page++;
  10.541 -                    vga_setpage(page);
  10.542 -                    vp &= 0xffff;
  10.543 -                } else {
  10.544 -                    SDL_memcpy(dst + vp, src, 0x10000 - vp);
  10.545 -                    page++;
  10.546 -                    vga_setpage(page);
  10.547 -                    SDL_memcpy(dst, src + 0x10000 - vp, (vp + w) & 0xffff);
  10.548 -                    vp = (vp + pitch) & 0xffff;
  10.549 -                    src += pitch;
  10.550 -                    continue;
  10.551 -                }
  10.552 -            }
  10.553 -            SDL_memcpy(dst + vp, src, w);
  10.554 -            src += pitch;
  10.555 -            vp += pitch;
  10.556 -        }
  10.557 -    }
  10.558 -}
  10.559 -
  10.560 -int
  10.561 -SVGA_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
  10.562 -{
  10.563 -    int i;
  10.564 -
  10.565 -    for (i = 0; i < ncolors; i++) {
  10.566 -        vga_setpalette(firstcolor + i,
  10.567 -                       colors[i].r >> 2, colors[i].g >> 2, colors[i].b >> 2);
  10.568 -    }
  10.569 -    return (1);
  10.570 -}
  10.571 -
  10.572 -/* Note:  If we are terminated, this could be called in the middle of
  10.573 -   another SDL video routine -- notably UpdateRects.
  10.574 -*/
  10.575 -void
  10.576 -SVGA_VideoQuit(_THIS)
  10.577 -{
  10.578 -    int i, j;
  10.579 -
  10.580 -    /* Reset the console video mode */
  10.581 -    if (this->screen && (this->screen->w && this->screen->h)) {
  10.582 -        vga_setmode(TEXT);
  10.583 -    }
  10.584 -    keyboard_close();
  10.585 -
  10.586 -    /* Free video mode lists */
  10.587 -    for (i = 0; i < NUM_MODELISTS; ++i) {
  10.588 -        if (SDL_modelist[i] != NULL) {
  10.589 -            for (j = 0; SDL_modelist[i][j]; ++j)
  10.590 -                SDL_free(SDL_modelist[i][j]);
  10.591 -            SDL_free(SDL_modelist[i]);
  10.592 -            SDL_modelist[i] = NULL;
  10.593 -        }
  10.594 -        if (SDL_vgamode[i] != NULL) {
  10.595 -            SDL_free(SDL_vgamode[i]);
  10.596 -            SDL_vgamode[i] = NULL;
  10.597 -        }
  10.598 -    }
  10.599 -    if (this->screen) {
  10.600 -        if (banked && this->screen->pixels) {
  10.601 -            SDL_free(this->screen->pixels);
  10.602 -        }
  10.603 -        this->screen->pixels = NULL;
  10.604 -    }
  10.605 -}
  10.606 -
  10.607 -/* vi: set ts=4 sw=4 expandtab: */
    11.1 --- a/src/video/svga/SDL_svgavideo.h	Wed Jan 19 22:20:44 2011 -0800
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,59 +0,0 @@
    11.4 -/*
    11.5 -    SDL - Simple DirectMedia Layer
    11.6 -    Copyright (C) 1997-2010 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 Lesser General Public
   11.10 -    License as published by the Free Software Foundation; either
   11.11 -    version 2.1 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 -    Lesser General Public License for more details.
   11.17 -
   11.18 -    You should have received a copy of the GNU Lesser General Public
   11.19 -    License along with this library; if not, write to the Free Software
   11.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   11.21 -
   11.22 -    Sam Lantinga
   11.23 -    slouken@libsdl.org
   11.24 -*/
   11.25 -#include "SDL_config.h"
   11.26 -
   11.27 -#ifndef _SDL_svgavideo_h
   11.28 -#define _SDL_svgavideo_h
   11.29 -
   11.30 -#include "SDL_mouse.h"
   11.31 -#include "../SDL_sysvideo.h"
   11.32 -
   11.33 -/* Hidden "this" pointer for the video functions */
   11.34 -#define _THIS	SDL_VideoDevice *this
   11.35 -
   11.36 -/* Private display data */
   11.37 -struct SDL_PrivateVideoData
   11.38 -{
   11.39 -#define NUM_MODELISTS	4       /* 8, 16, 24, and 32 bits-per-pixel */
   11.40 -    int SDL_nummodes[NUM_MODELISTS];
   11.41 -    SDL_Rect **SDL_modelist[NUM_MODELISTS];
   11.42 -    int *SDL_vgamode[NUM_MODELISTS];
   11.43 -
   11.44 -    /* information for double-buffering */
   11.45 -    int flip_page;
   11.46 -    int flip_offset[2];
   11.47 -    Uint8 *flip_address[2];
   11.48 -
   11.49 -    /* Set to 1 if we're in banked video mode */
   11.50 -    int banked;
   11.51 -};
   11.52 -/* Old variable names */
   11.53 -#define SDL_nummodes		(this->hidden->SDL_nummodes)
   11.54 -#define SDL_modelist		(this->hidden->SDL_modelist)
   11.55 -#define SDL_vgamode		(this->hidden->SDL_vgamode)
   11.56 -#define flip_page		(this->hidden->flip_page)
   11.57 -#define flip_offset		(this->hidden->flip_offset)
   11.58 -#define flip_address		(this->hidden->flip_address)
   11.59 -#define	banked			(this->hidden->banked)
   11.60 -
   11.61 -#endif /* _SDL_svgavideo_h */
   11.62 -/* vi: set ts=4 sw=4 expandtab: */