Started framework for Windows video driver SDL-1.3
authorSam Lantinga <slouken@libsdl.org>
Mon, 26 Jun 2006 13:56:56 +0000
branchSDL-1.3
changeset 1712931d111e737a
parent 1711 865ba39fc96d
child 1713 3e66ed1690e4
Started framework for Windows video driver
configure.in
include/SDL_compat.h
include/SDL_config.h.in
include/SDL_syswm.h
src/SDL.c
src/SDL_compat.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/dummy/SDL_nullvideo.h
src/video/win32/SDL_win32events.c
src/video/win32/SDL_win32events.h
src/video/win32/SDL_win32video.c
src/video/win32/SDL_win32video.h
src/video/win32/SDL_win32window.c
src/video/win32/SDL_win32window.h
test/Makefile.in
test/testsprite.c
test/testsprite2.c
test/testwm2.c
test/threadwin.c
     1.1 --- a/configure.in	Mon Jun 26 05:27:34 2006 +0000
     1.2 +++ b/configure.in	Mon Jun 26 13:56:56 2006 +0000
     1.3 @@ -1861,9 +1861,8 @@
     1.4      fi
     1.5  
     1.6      if test x$enable_video = xyes; then
     1.7 -        AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
     1.8 -        SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
     1.9 -        SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
    1.10 +        AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
    1.11 +        SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
    1.12          have_video=yes
    1.13      fi
    1.14  }
    1.15 @@ -1875,18 +1874,8 @@
    1.16  AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
    1.17                    , enable_directx=yes)
    1.18      if test x$enable_directx = xyes; then
    1.19 -        have_directx=no
    1.20 -        AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
    1.21          AC_CHECK_HEADER(dsound.h, have_dsound=yes)
    1.22          AC_CHECK_HEADER(dinput.h, use_dinput=yes)
    1.23 -        if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
    1.24 -            have_directx=yes
    1.25 -        fi
    1.26 -        if test x$enable_video = xyes -a x$have_directx = xyes; then
    1.27 -            AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
    1.28 -            SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
    1.29 -            have_video=yes
    1.30 -        fi
    1.31      fi
    1.32  }
    1.33  
    1.34 @@ -2311,7 +2300,7 @@
    1.35          if test x$enable_audio = xyes; then
    1.36              AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
    1.37              SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
    1.38 -            if test x$have_directx = xyes; then
    1.39 +            if test x$have_dsound = xyes; then
    1.40                  AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
    1.41                  SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
    1.42              fi
    1.43 @@ -2319,7 +2308,7 @@
    1.44          fi
    1.45          # Set up files for the joystick library
    1.46          if test x$enable_joystick = xyes; then
    1.47 -            if test x$have_directx = xyes; then
    1.48 +            if test x$have_dinput = xyes; then
    1.49                  AC_DEFINE(SDL_JOYSTICK_DINPUT)
    1.50                  SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
    1.51              else
    1.52 @@ -2357,9 +2346,6 @@
    1.53          fi
    1.54          # Set up the system libraries we need
    1.55          EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
    1.56 -        if test x$have_directx = xyes; then
    1.57 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
    1.58 -        fi
    1.59          # The Win32 platform requires special setup
    1.60          SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
    1.61          SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
     2.1 --- a/include/SDL_compat.h	Mon Jun 26 05:27:34 2006 +0000
     2.2 +++ b/include/SDL_compat.h	Mon Jun 26 13:56:56 2006 +0000
     2.3 @@ -26,7 +26,7 @@
     2.4  #define _SDL_compat_h
     2.5  
     2.6  #include "SDL_video.h"
     2.7 -#include "SDL_syswm.h"
     2.8 +#include "SDL_version.h"
     2.9  
    2.10  #include "begin_code.h"
    2.11  /* Set up for C function definitions, even when using C++ */
    2.12 @@ -117,6 +117,8 @@
    2.13      SDL_GRAB_ON = 1
    2.14  } SDL_GrabMode;
    2.15  
    2.16 +struct SDL_SysWMinfo;
    2.17 +
    2.18  #define SDL_AllocSurface    SDL_CreateRGBSurface
    2.19  
    2.20  extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
    2.21 @@ -151,7 +153,7 @@
    2.22  extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
    2.23                                            const SDL_Color * colors,
    2.24                                            int firstcolor, int ncolors);
    2.25 -extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo * info);
    2.26 +extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo * info);
    2.27  extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
    2.28  extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
    2.29  extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
     3.1 --- a/include/SDL_config.h.in	Mon Jun 26 05:27:34 2006 +0000
     3.2 +++ b/include/SDL_config.h.in	Mon Jun 26 13:56:56 2006 +0000
     3.3 @@ -253,7 +253,6 @@
     3.4  #undef SDL_VIDEO_DRIVER_BWINDOW
     3.5  #undef SDL_VIDEO_DRIVER_CYBERGRAPHICS
     3.6  #undef SDL_VIDEO_DRIVER_DC
     3.7 -#undef SDL_VIDEO_DRIVER_DDRAW
     3.8  #undef SDL_VIDEO_DRIVER_DGA
     3.9  #undef SDL_VIDEO_DRIVER_DIRECTFB
    3.10  #undef SDL_VIDEO_DRIVER_DRAWSPROCKET
    3.11 @@ -276,7 +275,7 @@
    3.12  #undef SDL_VIDEO_DRIVER_SVGALIB
    3.13  #undef SDL_VIDEO_DRIVER_TOOLBOX
    3.14  #undef SDL_VIDEO_DRIVER_VGL
    3.15 -#undef SDL_VIDEO_DRIVER_WINDIB
    3.16 +#undef SDL_VIDEO_DRIVER_WIN32
    3.17  #undef SDL_VIDEO_DRIVER_WSCONS
    3.18  #undef SDL_VIDEO_DRIVER_X11
    3.19  #undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
     4.1 --- a/include/SDL_syswm.h	Mon Jun 26 05:27:34 2006 +0000
     4.2 +++ b/include/SDL_syswm.h	Mon Jun 26 13:56:56 2006 +0000
     4.3 @@ -129,7 +129,7 @@
     4.4      GR_WINDOW_ID window;        /* The display window */
     4.5  };
     4.6  
     4.7 -#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
     4.8 +#elif defined(SDL_VIDEO_DRIVER_WIN32)
     4.9  #define WIN32_LEAN_AND_MEAN
    4.10  #include <windows.h>
    4.11  
     5.1 --- a/src/SDL.c	Mon Jun 26 05:27:34 2006 +0000
     5.2 +++ b/src/SDL.c	Mon Jun 26 13:56:56 2006 +0000
     5.3 @@ -348,6 +348,11 @@
     5.4  }
     5.5  #endif /* building DLL with Watcom C */
     5.6  
     5.7 +void SDL_SetModuleHandle(void *hInst)
     5.8 +{
     5.9 +    /* FIXME: Do we still need this? */
    5.10 +}
    5.11 +
    5.12  #endif /* OS/2 elif __WIN32__ */
    5.13  
    5.14  /* vi: set ts=4 sw=4 expandtab: */
     6.1 --- a/src/SDL_compat.c	Mon Jun 26 05:27:34 2006 +0000
     6.2 +++ b/src/SDL_compat.c	Mon Jun 26 13:56:56 2006 +0000
     6.3 @@ -24,6 +24,7 @@
     6.4  /* This file contains functions for backwards compatibility with SDL 1.2 */
     6.5  
     6.6  #include "SDL.h"
     6.7 +#include "SDL_syswm.h"
     6.8  
     6.9  #include "video/SDL_pixels_c.h"
    6.10  
     7.1 --- a/src/video/SDL_sysvideo.h	Mon Jun 26 05:27:34 2006 +0000
     7.2 +++ b/src/video/SDL_sysvideo.h	Mon Jun 26 13:56:56 2006 +0000
     7.3 @@ -29,14 +29,6 @@
     7.4  #include "SDL_syswm.h"
     7.5  #undef SDL_PROTOTYPES_ONLY
     7.6  
     7.7 -/* This file prototypes the video driver implementation.
     7.8 -   This is designed to be easily converted to C++ in the future.
     7.9 - */
    7.10 -
    7.11 -#if SDL_VIDEO_OPENGL
    7.12 -#include "SDL_opengl.h"
    7.13 -#endif /* SDL_VIDEO_OPENGL */
    7.14 -
    7.15  /* The SDL video driver */
    7.16  
    7.17  typedef struct SDL_Window SDL_Window;
    7.18 @@ -256,21 +248,6 @@
    7.19      /* Swap the current buffers in double buffer mode. */
    7.20      void (*GL_SwapBuffers) (_THIS);
    7.21  
    7.22 -    /* OpenGL functions for glSDL */
    7.23 -#if SDL_VIDEO_OPENGL
    7.24 -#if !defined(__WIN32__)
    7.25 -#define WINAPI
    7.26 -#endif
    7.27 -#define SDL_PROC(ret,func,params) ret (WINAPI *func) params;
    7.28 -#include "SDL_glfuncs.h"
    7.29 -#undef SDL_PROC
    7.30 -
    7.31 -    /* Texture id */
    7.32 -    GLuint texture;
    7.33 -
    7.34 -    int is_32bit;
    7.35 -#endif
    7.36 -
    7.37      /* Determine whether the mouse should be in relative mode or not.
    7.38         This function is called when the input grab state or cursor
    7.39         visibility state changes.
    7.40 @@ -330,7 +307,6 @@
    7.41      /* The function used to dispose of this structure */
    7.42      void (*free) (_THIS);
    7.43  };
    7.44 -#undef _THIS
    7.45  
    7.46  typedef struct VideoBootStrap
    7.47  {
    7.48 @@ -382,11 +358,8 @@
    7.49  #if SDL_VIDEO_DRIVER_GAPI
    7.50  extern VideoBootStrap GAPI_bootstrap;
    7.51  #endif
    7.52 -#if SDL_VIDEO_DRIVER_WINDIB
    7.53 -extern VideoBootStrap WINDIB_bootstrap;
    7.54 -#endif
    7.55 -#if SDL_VIDEO_DRIVER_DDRAW
    7.56 -extern VideoBootStrap DIRECTX_bootstrap;
    7.57 +#if SDL_VIDEO_DRIVER_WIN32
    7.58 +extern VideoBootStrap WIN32_bootstrap;
    7.59  #endif
    7.60  #if SDL_VIDEO_DRIVER_BWINDOW
    7.61  extern VideoBootStrap BWINDOW_bootstrap;
     8.1 --- a/src/video/SDL_video.c	Mon Jun 26 05:27:34 2006 +0000
     8.2 +++ b/src/video/SDL_video.c	Mon Jun 26 13:56:56 2006 +0000
     8.3 @@ -75,11 +75,8 @@
     8.4  #if SDL_VIDEO_DRIVER_GAPI
     8.5      &GAPI_bootstrap,
     8.6  #endif
     8.7 -#if SDL_VIDEO_DRIVER_WINDIB
     8.8 -    &WINDIB_bootstrap,
     8.9 -#endif
    8.10 -#if SDL_VIDEO_DRIVER_DDRAW
    8.11 -    &DIRECTX_bootstrap,
    8.12 +#if SDL_VIDEO_DRIVER_WIN32
    8.13 +    &WIN32_bootstrap,
    8.14  #endif
    8.15  #if SDL_VIDEO_DRIVER_BWINDOW
    8.16      &BWINDOW_bootstrap,
     9.1 --- a/src/video/dummy/SDL_nullvideo.h	Mon Jun 26 05:27:34 2006 +0000
     9.2 +++ b/src/video/dummy/SDL_nullvideo.h	Mon Jun 26 13:56:56 2006 +0000
     9.3 @@ -34,9 +34,9 @@
     9.4  
     9.5  struct SDL_PrivateVideoData
     9.6  {
     9.7 -    int w, h;
     9.8 -    void *buffer;
     9.9 +    int unused;
    9.10  };
    9.11  
    9.12  #endif /* _SDL_nullvideo_h */
    9.13 +
    9.14  /* vi: set ts=4 sw=4 expandtab: */
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/src/video/win32/SDL_win32events.c	Mon Jun 26 13:56:56 2006 +0000
    10.3 @@ -0,0 +1,31 @@
    10.4 +/*
    10.5 +    SDL - Simple DirectMedia Layer
    10.6 +    Copyright (C) 1997-2006 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 +#include "SDL_win32video.h"
   10.28 +
   10.29 +void
   10.30 +WIN32_PumpEvents(_THIS)
   10.31 +{
   10.32 +}
   10.33 +
   10.34 +/* vi: set ts=4 sw=4 expandtab: */
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/src/video/win32/SDL_win32events.h	Mon Jun 26 13:56:56 2006 +0000
    11.3 @@ -0,0 +1,33 @@
    11.4 +/*
    11.5 +    SDL - Simple DirectMedia Layer
    11.6 +    Copyright (C) 1997-2006 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_win32events_h
   11.28 +#define _SDL_win32events_h
   11.29 +
   11.30 +#include "../SDL_sysvideo.h"
   11.31 +
   11.32 +extern void WIN32_PumpEvents(_THIS);
   11.33 +
   11.34 +#endif /* _SDL_win32events_h */
   11.35 +
   11.36 +/* vi: set ts=4 sw=4 expandtab: */
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/video/win32/SDL_win32video.c	Mon Jun 26 13:56:56 2006 +0000
    12.3 @@ -0,0 +1,134 @@
    12.4 +/*
    12.5 +    SDL - Simple DirectMedia Layer
    12.6 +    Copyright (C) 1997-2006 Sam Lantinga
    12.7 +
    12.8 +    This library is free software; you can redistribute it and/or
    12.9 +    modify it under the terms of the GNU Lesser General Public
   12.10 +    License as published by the Free Software Foundation; either
   12.11 +    version 2.1 of the License, or (at your option) any later version.
   12.12 +
   12.13 +    This library is distributed in the hope that it will be useful,
   12.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12.16 +    Lesser General Public License for more details.
   12.17 +
   12.18 +    You should have received a copy of the GNU Lesser General Public
   12.19 +    License along with this library; if not, write to the Free Software
   12.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   12.21 +
   12.22 +    Sam Lantinga
   12.23 +    slouken@libsdl.org
   12.24 +*/
   12.25 +#include "SDL_config.h"
   12.26 +
   12.27 +#include "SDL_video.h"
   12.28 +#include "SDL_mouse.h"
   12.29 +#include "../SDL_sysvideo.h"
   12.30 +#include "../SDL_pixels_c.h"
   12.31 +
   12.32 +#include "SDL_win32video.h"
   12.33 +#include "SDL_win32events.h"
   12.34 +#include "SDL_win32window.h"
   12.35 +
   12.36 +/* Initialization/Query functions */
   12.37 +static int WIN32_VideoInit(_THIS);
   12.38 +static int WIN32_SetDisplayMode(_THIS, const SDL_DisplayMode * mode);
   12.39 +static void WIN32_VideoQuit(_THIS);
   12.40 +
   12.41 +/* WIN32 driver bootstrap functions */
   12.42 +
   12.43 +static int
   12.44 +WIN32_Available(void)
   12.45 +{
   12.46 +    return (1);
   12.47 +}
   12.48 +
   12.49 +static void
   12.50 +WIN32_DeleteDevice(SDL_VideoDevice * device)
   12.51 +{
   12.52 +    SDL_free(device->hidden);
   12.53 +    SDL_free(device);
   12.54 +}
   12.55 +
   12.56 +static SDL_VideoDevice *
   12.57 +WIN32_CreateDevice(int devindex)
   12.58 +{
   12.59 +    SDL_VideoDevice *device;
   12.60 +
   12.61 +    /* Initialize all variables that we clean on shutdown */
   12.62 +    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
   12.63 +    if (device) {
   12.64 +        SDL_memset(device, 0, (sizeof *device));
   12.65 +        device->hidden = (struct SDL_PrivateVideoData *)
   12.66 +            SDL_malloc((sizeof *device->hidden));
   12.67 +    }
   12.68 +    if ((device == NULL) || (device->hidden == NULL)) {
   12.69 +        SDL_OutOfMemory();
   12.70 +        if (device) {
   12.71 +            SDL_free(device);
   12.72 +        }
   12.73 +        return (0);
   12.74 +    }
   12.75 +    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
   12.76 +
   12.77 +    /* Set the function pointers */
   12.78 +    device->VideoInit = WIN32_VideoInit;
   12.79 +    device->SetDisplayMode = WIN32_SetDisplayMode;
   12.80 +    device->VideoQuit = WIN32_VideoQuit;
   12.81 +    device->PumpEvents = WIN32_PumpEvents;
   12.82 +
   12.83 +#undef CreateWindow
   12.84 +    device->CreateWindow = WIN32_CreateWindow;
   12.85 +    device->CreateWindowFrom = WIN32_CreateWindowFrom;
   12.86 +    device->SetWindowTitle = WIN32_SetWindowTitle;
   12.87 +    device->SetWindowPosition = WIN32_SetWindowPosition;
   12.88 +    device->SetWindowSize = WIN32_SetWindowSize;
   12.89 +    device->ShowWindow = WIN32_ShowWindow;
   12.90 +    device->HideWindow = WIN32_HideWindow;
   12.91 +    device->RaiseWindow = WIN32_RaiseWindow;
   12.92 +    device->MaximizeWindow = WIN32_MaximizeWindow;
   12.93 +    device->MinimizeWindow = WIN32_MinimizeWindow;
   12.94 +    device->RestoreWindow = WIN32_RestoreWindow;
   12.95 +    device->SetWindowGrab = WIN32_SetWindowGrab;
   12.96 +    device->DestroyWindow = WIN32_DestroyWindow;
   12.97 +    device->GetWindowWMInfo = WIN32_GetWindowWMInfo;
   12.98 +
   12.99 +    device->free = WIN32_DeleteDevice;
  12.100 +
  12.101 +    return device;
  12.102 +}
  12.103 +
  12.104 +VideoBootStrap WIN32_bootstrap = {
  12.105 +    "win32", "SDL Win32/64 video driver",
  12.106 +    WIN32_Available, WIN32_CreateDevice
  12.107 +};
  12.108 +
  12.109 +
  12.110 +int
  12.111 +WIN32_VideoInit(_THIS)
  12.112 +{
  12.113 +    SDL_DisplayMode mode;
  12.114 +
  12.115 +    SDL_AddBasicVideoDisplay(NULL);
  12.116 +    //SDL_AddRenderDriver(0, &SDL_WIN32_RenderDriver);
  12.117 +
  12.118 +    SDL_zero(mode);
  12.119 +    SDL_AddDisplayMode(0, &mode);
  12.120 +
  12.121 +    /* We're done! */
  12.122 +    return 0;
  12.123 +}
  12.124 +
  12.125 +static int
  12.126 +WIN32_SetDisplayMode(_THIS, const SDL_DisplayMode * mode)
  12.127 +{
  12.128 +    SDL_CurrentDisplay.current_mode = *mode;
  12.129 +    return 0;
  12.130 +}
  12.131 +
  12.132 +void
  12.133 +WIN32_VideoQuit(_THIS)
  12.134 +{
  12.135 +}
  12.136 +
  12.137 +/* vim: set ts=4 sw=4 expandtab: */
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/video/win32/SDL_win32video.h	Mon Jun 26 13:56:56 2006 +0000
    13.3 @@ -0,0 +1,43 @@
    13.4 +/*
    13.5 +    SDL - Simple DirectMedia Layer
    13.6 +    Copyright (C) 1997-2006 Sam Lantinga
    13.7 +
    13.8 +    This library is free software; you can redistribute it and/or
    13.9 +    modify it under the terms of the GNU Lesser General Public
   13.10 +    License as published by the Free Software Foundation; either
   13.11 +    version 2.1 of the License, or (at your option) any later version.
   13.12 +
   13.13 +    This library is distributed in the hope that it will be useful,
   13.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13.16 +    Lesser General Public License for more details.
   13.17 +
   13.18 +    You should have received a copy of the GNU Lesser General Public
   13.19 +    License along with this library; if not, write to the Free Software
   13.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   13.21 +
   13.22 +    Sam Lantinga
   13.23 +    slouken@libsdl.org
   13.24 +*/
   13.25 +#include "SDL_config.h"
   13.26 +
   13.27 +#ifndef _SDL_win32video_h
   13.28 +#define _SDL_win32video_h
   13.29 +
   13.30 +#include "../SDL_sysvideo.h"
   13.31 +
   13.32 +#define WIN32_LEAN_AND_MEAN
   13.33 +#include <windows.h>
   13.34 +
   13.35 +#include "SDL_win32events.h"
   13.36 +#include "SDL_win32window.h"
   13.37 +
   13.38 +/* Private display data */
   13.39 +
   13.40 +struct SDL_PrivateVideoData
   13.41 +{
   13.42 +};
   13.43 +
   13.44 +#endif /* _SDL_win32video_h */
   13.45 +
   13.46 +/* vi: set ts=4 sw=4 expandtab: */
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/src/video/win32/SDL_win32window.c	Mon Jun 26 13:56:56 2006 +0000
    14.3 @@ -0,0 +1,85 @@
    14.4 +/*
    14.5 +    SDL - Simple DirectMedia Layer
    14.6 +    Copyright (C) 1997-2006 Sam Lantinga
    14.7 +
    14.8 +    This library is free software; you can redistribute it and/or
    14.9 +    modify it under the terms of the GNU Lesser General Public
   14.10 +    License as published by the Free Software Foundation; either
   14.11 +    version 2.1 of the License, or (at your option) any later version.
   14.12 +
   14.13 +    This library is distributed in the hope that it will be useful,
   14.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   14.16 +    Lesser General Public License for more details.
   14.17 +
   14.18 +    You should have received a copy of the GNU Lesser General Public
   14.19 +    License along with this library; if not, write to the Free Software
   14.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   14.21 +
   14.22 +    Sam Lantinga
   14.23 +    slouken@libsdl.org
   14.24 +*/
   14.25 +#include "SDL_config.h"
   14.26 +
   14.27 +#include "../SDL_sysvideo.h"
   14.28 +
   14.29 +#include "SDL_win32video.h"
   14.30 +
   14.31 +
   14.32 +int WIN32_CreateWindow(_THIS, SDL_Window * window)
   14.33 +{
   14.34 +}
   14.35 +
   14.36 +int WIN32_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
   14.37 +{
   14.38 +}
   14.39 +
   14.40 +void WIN32_SetWindowTitle(_THIS, SDL_Window * window)
   14.41 +{
   14.42 +}
   14.43 +
   14.44 +void WIN32_SetWindowPosition(_THIS, SDL_Window * window)
   14.45 +{
   14.46 +}
   14.47 +
   14.48 +void WIN32_SetWindowSize(_THIS, SDL_Window * window)
   14.49 +{
   14.50 +}
   14.51 +
   14.52 +void WIN32_ShowWindow(_THIS, SDL_Window * window)
   14.53 +{
   14.54 +}
   14.55 +
   14.56 +void WIN32_HideWindow(_THIS, SDL_Window * window)
   14.57 +{
   14.58 +}
   14.59 +
   14.60 +void WIN32_RaiseWindow(_THIS, SDL_Window * window)
   14.61 +{
   14.62 +}
   14.63 +
   14.64 +void WIN32_MaximizeWindow(_THIS, SDL_Window * window)
   14.65 +{
   14.66 +}
   14.67 +
   14.68 +void WIN32_MinimizeWindow(_THIS, SDL_Window * window)
   14.69 +{
   14.70 +}
   14.71 +
   14.72 +void WIN32_RestoreWindow(_THIS, SDL_Window * window)
   14.73 +{
   14.74 +}
   14.75 +
   14.76 +void WIN32_SetWindowGrab(_THIS, SDL_Window * window)
   14.77 +{
   14.78 +}
   14.79 +
   14.80 +void WIN32_DestroyWindow(_THIS, SDL_Window * window)
   14.81 +{
   14.82 +}
   14.83 +
   14.84 +SDL_bool WIN32_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
   14.85 +{
   14.86 +}
   14.87 +
   14.88 +/* vi: set ts=4 sw=4 expandtab: */
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/src/video/win32/SDL_win32window.h	Mon Jun 26 13:56:56 2006 +0000
    15.3 @@ -0,0 +1,47 @@
    15.4 +/*
    15.5 +    SDL - Simple DirectMedia Layer
    15.6 +    Copyright (C) 1997-2006 Sam Lantinga
    15.7 +
    15.8 +    This library is free software; you can redistribute it and/or
    15.9 +    modify it under the terms of the GNU Lesser General Public
   15.10 +    License as published by the Free Software Foundation; either
   15.11 +    version 2.1 of the License, or (at your option) any later version.
   15.12 +
   15.13 +    This library is distributed in the hope that it will be useful,
   15.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   15.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15.16 +    Lesser General Public License for more details.
   15.17 +
   15.18 +    You should have received a copy of the GNU Lesser General Public
   15.19 +    License along with this library; if not, write to the Free Software
   15.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   15.21 +
   15.22 +    Sam Lantinga
   15.23 +    slouken@libsdl.org
   15.24 +*/
   15.25 +#include "SDL_config.h"
   15.26 +
   15.27 +#ifndef _SDL_win32window_h
   15.28 +#define _SDL_win32window_h
   15.29 +
   15.30 +#include "../SDL_sysvideo.h"
   15.31 +#include "SDL_win32video.h"
   15.32 +
   15.33 +extern int WIN32_CreateWindow(_THIS, SDL_Window * window);
   15.34 +extern int WIN32_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
   15.35 +extern void WIN32_SetWindowTitle(_THIS, SDL_Window * window);
   15.36 +extern void WIN32_SetWindowPosition(_THIS, SDL_Window * window);
   15.37 +extern void WIN32_SetWindowSize(_THIS, SDL_Window * window);
   15.38 +extern void WIN32_ShowWindow(_THIS, SDL_Window * window);
   15.39 +extern void WIN32_HideWindow(_THIS, SDL_Window * window);
   15.40 +extern void WIN32_RaiseWindow(_THIS, SDL_Window * window);
   15.41 +extern void WIN32_MaximizeWindow(_THIS, SDL_Window * window);
   15.42 +extern void WIN32_MinimizeWindow(_THIS, SDL_Window * window);
   15.43 +extern void WIN32_RestoreWindow(_THIS, SDL_Window * window);
   15.44 +extern void WIN32_SetWindowGrab(_THIS, SDL_Window * window);
   15.45 +extern void WIN32_DestroyWindow(_THIS, SDL_Window * window);
   15.46 +extern SDL_bool WIN32_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
   15.47 +
   15.48 +#endif /* _SDL_win32window_h */
   15.49 +
   15.50 +/* vi: set ts=4 sw=4 expandtab: */
    16.1 --- a/test/Makefile.in	Mon Jun 26 05:27:34 2006 +0000
    16.2 +++ b/test/Makefile.in	Mon Jun 26 13:56:56 2006 +0000
    16.3 @@ -7,7 +7,7 @@
    16.4  CFLAGS  = @CFLAGS@
    16.5  LIBS	= @LIBS@
    16.6  
    16.7 -TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testalpha$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcdrom$(EXE) testcursor$(EXE) testdyngl$(EXE) testerror$(EXE) testfile$(EXE) testgamma$(EXE) testgl$(EXE) testhread$(EXE) testiconv$(EXE) testjoystick$(EXE) testkeys$(EXE) testlock$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testpalette$(EXE) testplatform$(EXE) testsem$(EXE) testsprite$(EXE) testsprite2$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm$(EXE) threadwin$(EXE) torturethread$(EXE)
    16.8 +TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testalpha$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcdrom$(EXE) testcursor$(EXE) testdyngl$(EXE) testerror$(EXE) testfile$(EXE) testgamma$(EXE) testgl$(EXE) testhread$(EXE) testiconv$(EXE) testjoystick$(EXE) testkeys$(EXE) testlock$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testpalette$(EXE) testplatform$(EXE) testsem$(EXE) testsprite$(EXE) testsprite2$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm$(EXE) testwm2$(EXE) threadwin$(EXE) torturethread$(EXE)
    16.9  
   16.10  all: $(TARGETS)
   16.11  
   16.12 @@ -101,6 +101,9 @@
   16.13  testwm$(EXE): $(srcdir)/testwm.c
   16.14  	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
   16.15  
   16.16 +testwm2$(EXE): $(srcdir)/testwm.c
   16.17 +	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
   16.18 +
   16.19  threadwin$(EXE): $(srcdir)/threadwin.c
   16.20  	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
   16.21  
    17.1 --- a/test/testsprite.c	Mon Jun 26 05:27:34 2006 +0000
    17.2 +++ b/test/testsprite.c	Mon Jun 26 13:56:56 2006 +0000
    17.3 @@ -1,10 +1,6 @@
    17.4  /* Simple program:  Move N sprites around on the screen as fast as possible */
    17.5  
    17.6 -#include <stdio.h>
    17.7  #include <stdlib.h>
    17.8 -#include <string.h>
    17.9 -#include <ctype.h>
   17.10 -#include <math.h>
   17.11  #include <time.h>
   17.12  
   17.13  #include "SDL.h"
    18.1 --- a/test/testsprite2.c	Mon Jun 26 05:27:34 2006 +0000
    18.2 +++ b/test/testsprite2.c	Mon Jun 26 13:56:56 2006 +0000
    18.3 @@ -1,10 +1,6 @@
    18.4  /* Simple program:  Move N sprites around on the screen as fast as possible */
    18.5  
    18.6 -#include <stdio.h>
    18.7  #include <stdlib.h>
    18.8 -#include <string.h>
    18.9 -#include <ctype.h>
   18.10 -#include <math.h>
   18.11  #include <time.h>
   18.12  
   18.13  #include "SDL.h"
   18.14 @@ -122,7 +118,6 @@
   18.15  int
   18.16  main(int argc, char *argv[])
   18.17  {
   18.18 -    const SDL_DisplayMode *current_mode;
   18.19      int window_w, window_h;
   18.20      int i, done;
   18.21      SDL_Event event;
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/test/testwm2.c	Mon Jun 26 13:56:56 2006 +0000
    19.3 @@ -0,0 +1,99 @@
    19.4 +/* Simple program:  Move N sprites around on the screen as fast as possible */
    19.5 +
    19.6 +#include "SDL.h"
    19.7 +
    19.8 +#define NUM_WINDOWS 2
    19.9 +#define WINDOW_W    640
   19.10 +#define WINDOW_H    480
   19.11 +
   19.12 +static int num_windows;
   19.13 +static SDL_WindowID *windows;
   19.14 +
   19.15 +/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
   19.16 +static void
   19.17 +quit(int rc)
   19.18 +{
   19.19 +    if (windows) {
   19.20 +        SDL_free(windows);
   19.21 +    }
   19.22 +    SDL_Quit();
   19.23 +    exit(rc);
   19.24 +}
   19.25 +
   19.26 +int
   19.27 +main(int argc, char *argv[])
   19.28 +{
   19.29 +    int window_w, window_h;
   19.30 +    int i, done;
   19.31 +    SDL_Event event;
   19.32 +
   19.33 +    /* Initialize SDL */
   19.34 +    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
   19.35 +        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
   19.36 +        return (1);
   19.37 +    }
   19.38 +
   19.39 +    num_windows = NUM_WINDOWS;
   19.40 +    window_w = WINDOW_W;
   19.41 +    window_h = WINDOW_H;
   19.42 +    while (argc > 1) {
   19.43 +        --argc;
   19.44 +        if (strcmp(argv[argc - 1], "-width") == 0) {
   19.45 +            window_w = atoi(argv[argc]);
   19.46 +            --argc;
   19.47 +        } else if (strcmp(argv[argc - 1], "-height") == 0) {
   19.48 +            window_h = atoi(argv[argc]);
   19.49 +            --argc;
   19.50 +        } else {
   19.51 +            fprintf(stderr,
   19.52 +                    "Usage: %s [-width] [-height]\n", argv[0]);
   19.53 +            quit(1);
   19.54 +        }
   19.55 +    }
   19.56 +
   19.57 +    /* Set the desktop mode, we don't care what it is */
   19.58 +    if (SDL_SetDisplayMode(NULL) < 0) {
   19.59 +        fprintf(stderr, "Couldn't set display mode: %s\n", SDL_GetError());
   19.60 +        quit(2);
   19.61 +    }
   19.62 +
   19.63 +    /* Create the windows */
   19.64 +    windows = (SDL_WindowID *) SDL_malloc(num_windows * sizeof(*windows));
   19.65 +    if (!windows) {
   19.66 +        fprintf(stderr, "Out of memory!\n");
   19.67 +        quit(2);
   19.68 +    }
   19.69 +    for (i = 0; i < num_windows; ++i) {
   19.70 +        char title[32];
   19.71 +
   19.72 +        SDL_snprintf(title, sizeof(title), "testwm %d", i + 1);
   19.73 +        windows[i] =
   19.74 +            SDL_CreateWindow(title, -1, -1, window_w, window_h,
   19.75 +                             SDL_WINDOW_SHOWN);
   19.76 +        if (!windows[i]) {
   19.77 +            fprintf(stderr, "Couldn't create window: %s\n", SDL_GetError());
   19.78 +            quit(2);
   19.79 +        }
   19.80 +    }
   19.81 +
   19.82 +    /* Loop, blitting sprites and waiting for a keystroke */
   19.83 +    done = 0;
   19.84 +    while (!done) {
   19.85 +        /* Check for events */
   19.86 +        while (SDL_PollEvent(&event)) {
   19.87 +            switch (event.type) {
   19.88 +            case SDL_KEYDOWN:
   19.89 +                /* Any keypress quits the app... */
   19.90 +            case SDL_QUIT:
   19.91 +                done = 1;
   19.92 +                break;
   19.93 +            default:
   19.94 +                break;
   19.95 +            }
   19.96 +        }
   19.97 +    }
   19.98 +
   19.99 +    quit(0);
  19.100 +}
  19.101 +
  19.102 +/* vi: set ts=4 sw=4 expandtab: */
    20.1 --- a/test/threadwin.c	Mon Jun 26 05:27:34 2006 +0000
    20.2 +++ b/test/threadwin.c	Mon Jun 26 13:56:56 2006 +0000
    20.3 @@ -80,7 +80,7 @@
    20.4  }
    20.5  
    20.6  int SDLCALL
    20.7 -FilterEvents(const SDL_Event * event)
    20.8 +FilterEvents(SDL_Event * event)
    20.9  {
   20.10      static int reallyquit = 0;
   20.11