changeset 1712:931d111e737a SDL-1.3

Started framework for Windows video driver
author Sam Lantinga <slouken@libsdl.org>
date Mon, 26 Jun 2006 13:56:56 +0000
parents 865ba39fc96d
children 3e66ed1690e4
files 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
diffstat 20 files changed, 499 insertions(+), 70 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Mon Jun 26 05:27:34 2006 +0000
+++ b/configure.in	Mon Jun 26 13:56:56 2006 +0000
@@ -1861,9 +1861,8 @@
     fi
 
     if test x$enable_video = xyes; then
-        AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
-        SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
-        SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
+        AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
+        SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
         have_video=yes
     fi
 }
@@ -1875,18 +1874,8 @@
 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
                   , enable_directx=yes)
     if test x$enable_directx = xyes; then
-        have_directx=no
-        AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
-        if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
-            have_directx=yes
-        fi
-        if test x$enable_video = xyes -a x$have_directx = xyes; then
-            AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
-            SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
-            have_video=yes
-        fi
     fi
 }
 
@@ -2311,7 +2300,7 @@
         if test x$enable_audio = xyes; then
             AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
-            if test x$have_directx = xyes; then
+            if test x$have_dsound = xyes; then
                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
             fi
@@ -2319,7 +2308,7 @@
         fi
         # Set up files for the joystick library
         if test x$enable_joystick = xyes; then
-            if test x$have_directx = xyes; then
+            if test x$have_dinput = xyes; then
                 AC_DEFINE(SDL_JOYSTICK_DINPUT)
                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
             else
@@ -2357,9 +2346,6 @@
         fi
         # Set up the system libraries we need
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
-        if test x$have_directx = xyes; then
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
-        fi
         # The Win32 platform requires special setup
         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
--- a/include/SDL_compat.h	Mon Jun 26 05:27:34 2006 +0000
+++ b/include/SDL_compat.h	Mon Jun 26 13:56:56 2006 +0000
@@ -26,7 +26,7 @@
 #define _SDL_compat_h
 
 #include "SDL_video.h"
-#include "SDL_syswm.h"
+#include "SDL_version.h"
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -117,6 +117,8 @@
     SDL_GRAB_ON = 1
 } SDL_GrabMode;
 
+struct SDL_SysWMinfo;
+
 #define SDL_AllocSurface    SDL_CreateRGBSurface
 
 extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
@@ -151,7 +153,7 @@
 extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
                                           const SDL_Color * colors,
                                           int firstcolor, int ncolors);
-extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo * info);
+extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo * info);
 extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
 extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
 extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
--- a/include/SDL_config.h.in	Mon Jun 26 05:27:34 2006 +0000
+++ b/include/SDL_config.h.in	Mon Jun 26 13:56:56 2006 +0000
@@ -253,7 +253,6 @@
 #undef SDL_VIDEO_DRIVER_BWINDOW
 #undef SDL_VIDEO_DRIVER_CYBERGRAPHICS
 #undef SDL_VIDEO_DRIVER_DC
-#undef SDL_VIDEO_DRIVER_DDRAW
 #undef SDL_VIDEO_DRIVER_DGA
 #undef SDL_VIDEO_DRIVER_DIRECTFB
 #undef SDL_VIDEO_DRIVER_DRAWSPROCKET
@@ -276,7 +275,7 @@
 #undef SDL_VIDEO_DRIVER_SVGALIB
 #undef SDL_VIDEO_DRIVER_TOOLBOX
 #undef SDL_VIDEO_DRIVER_VGL
-#undef SDL_VIDEO_DRIVER_WINDIB
+#undef SDL_VIDEO_DRIVER_WIN32
 #undef SDL_VIDEO_DRIVER_WSCONS
 #undef SDL_VIDEO_DRIVER_X11
 #undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
--- a/include/SDL_syswm.h	Mon Jun 26 05:27:34 2006 +0000
+++ b/include/SDL_syswm.h	Mon Jun 26 13:56:56 2006 +0000
@@ -129,7 +129,7 @@
     GR_WINDOW_ID window;        /* The display window */
 };
 
-#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
+#elif defined(SDL_VIDEO_DRIVER_WIN32)
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
--- a/src/SDL.c	Mon Jun 26 05:27:34 2006 +0000
+++ b/src/SDL.c	Mon Jun 26 13:56:56 2006 +0000
@@ -348,6 +348,11 @@
 }
 #endif /* building DLL with Watcom C */
 
+void SDL_SetModuleHandle(void *hInst)
+{
+    /* FIXME: Do we still need this? */
+}
+
 #endif /* OS/2 elif __WIN32__ */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/SDL_compat.c	Mon Jun 26 05:27:34 2006 +0000
+++ b/src/SDL_compat.c	Mon Jun 26 13:56:56 2006 +0000
@@ -24,6 +24,7 @@
 /* This file contains functions for backwards compatibility with SDL 1.2 */
 
 #include "SDL.h"
+#include "SDL_syswm.h"
 
 #include "video/SDL_pixels_c.h"
 
--- a/src/video/SDL_sysvideo.h	Mon Jun 26 05:27:34 2006 +0000
+++ b/src/video/SDL_sysvideo.h	Mon Jun 26 13:56:56 2006 +0000
@@ -29,14 +29,6 @@
 #include "SDL_syswm.h"
 #undef SDL_PROTOTYPES_ONLY
 
-/* This file prototypes the video driver implementation.
-   This is designed to be easily converted to C++ in the future.
- */
-
-#if SDL_VIDEO_OPENGL
-#include "SDL_opengl.h"
-#endif /* SDL_VIDEO_OPENGL */
-
 /* The SDL video driver */
 
 typedef struct SDL_Window SDL_Window;
@@ -256,21 +248,6 @@
     /* Swap the current buffers in double buffer mode. */
     void (*GL_SwapBuffers) (_THIS);
 
-    /* OpenGL functions for glSDL */
-#if SDL_VIDEO_OPENGL
-#if !defined(__WIN32__)
-#define WINAPI
-#endif
-#define SDL_PROC(ret,func,params) ret (WINAPI *func) params;
-#include "SDL_glfuncs.h"
-#undef SDL_PROC
-
-    /* Texture id */
-    GLuint texture;
-
-    int is_32bit;
-#endif
-
     /* Determine whether the mouse should be in relative mode or not.
        This function is called when the input grab state or cursor
        visibility state changes.
@@ -330,7 +307,6 @@
     /* The function used to dispose of this structure */
     void (*free) (_THIS);
 };
-#undef _THIS
 
 typedef struct VideoBootStrap
 {
@@ -382,11 +358,8 @@
 #if SDL_VIDEO_DRIVER_GAPI
 extern VideoBootStrap GAPI_bootstrap;
 #endif
-#if SDL_VIDEO_DRIVER_WINDIB
-extern VideoBootStrap WINDIB_bootstrap;
-#endif
-#if SDL_VIDEO_DRIVER_DDRAW
-extern VideoBootStrap DIRECTX_bootstrap;
+#if SDL_VIDEO_DRIVER_WIN32
+extern VideoBootStrap WIN32_bootstrap;
 #endif
 #if SDL_VIDEO_DRIVER_BWINDOW
 extern VideoBootStrap BWINDOW_bootstrap;
--- a/src/video/SDL_video.c	Mon Jun 26 05:27:34 2006 +0000
+++ b/src/video/SDL_video.c	Mon Jun 26 13:56:56 2006 +0000
@@ -75,11 +75,8 @@
 #if SDL_VIDEO_DRIVER_GAPI
     &GAPI_bootstrap,
 #endif
-#if SDL_VIDEO_DRIVER_WINDIB
-    &WINDIB_bootstrap,
-#endif
-#if SDL_VIDEO_DRIVER_DDRAW
-    &DIRECTX_bootstrap,
+#if SDL_VIDEO_DRIVER_WIN32
+    &WIN32_bootstrap,
 #endif
 #if SDL_VIDEO_DRIVER_BWINDOW
     &BWINDOW_bootstrap,
--- a/src/video/dummy/SDL_nullvideo.h	Mon Jun 26 05:27:34 2006 +0000
+++ b/src/video/dummy/SDL_nullvideo.h	Mon Jun 26 13:56:56 2006 +0000
@@ -34,9 +34,9 @@
 
 struct SDL_PrivateVideoData
 {
-    int w, h;
-    void *buffer;
+    int unused;
 };
 
 #endif /* _SDL_nullvideo_h */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/win32/SDL_win32events.c	Mon Jun 26 13:56:56 2006 +0000
@@ -0,0 +1,31 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_win32video.h"
+
+void
+WIN32_PumpEvents(_THIS)
+{
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/win32/SDL_win32events.h	Mon Jun 26 13:56:56 2006 +0000
@@ -0,0 +1,33 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#ifndef _SDL_win32events_h
+#define _SDL_win32events_h
+
+#include "../SDL_sysvideo.h"
+
+extern void WIN32_PumpEvents(_THIS);
+
+#endif /* _SDL_win32events_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/win32/SDL_win32video.c	Mon Jun 26 13:56:56 2006 +0000
@@ -0,0 +1,134 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+
+#include "SDL_win32video.h"
+#include "SDL_win32events.h"
+#include "SDL_win32window.h"
+
+/* Initialization/Query functions */
+static int WIN32_VideoInit(_THIS);
+static int WIN32_SetDisplayMode(_THIS, const SDL_DisplayMode * mode);
+static void WIN32_VideoQuit(_THIS);
+
+/* WIN32 driver bootstrap functions */
+
+static int
+WIN32_Available(void)
+{
+    return (1);
+}
+
+static void
+WIN32_DeleteDevice(SDL_VideoDevice * device)
+{
+    SDL_free(device->hidden);
+    SDL_free(device);
+}
+
+static SDL_VideoDevice *
+WIN32_CreateDevice(int devindex)
+{
+    SDL_VideoDevice *device;
+
+    /* Initialize all variables that we clean on shutdown */
+    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
+    if (device) {
+        SDL_memset(device, 0, (sizeof *device));
+        device->hidden = (struct SDL_PrivateVideoData *)
+            SDL_malloc((sizeof *device->hidden));
+    }
+    if ((device == NULL) || (device->hidden == NULL)) {
+        SDL_OutOfMemory();
+        if (device) {
+            SDL_free(device);
+        }
+        return (0);
+    }
+    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
+
+    /* Set the function pointers */
+    device->VideoInit = WIN32_VideoInit;
+    device->SetDisplayMode = WIN32_SetDisplayMode;
+    device->VideoQuit = WIN32_VideoQuit;
+    device->PumpEvents = WIN32_PumpEvents;
+
+#undef CreateWindow
+    device->CreateWindow = WIN32_CreateWindow;
+    device->CreateWindowFrom = WIN32_CreateWindowFrom;
+    device->SetWindowTitle = WIN32_SetWindowTitle;
+    device->SetWindowPosition = WIN32_SetWindowPosition;
+    device->SetWindowSize = WIN32_SetWindowSize;
+    device->ShowWindow = WIN32_ShowWindow;
+    device->HideWindow = WIN32_HideWindow;
+    device->RaiseWindow = WIN32_RaiseWindow;
+    device->MaximizeWindow = WIN32_MaximizeWindow;
+    device->MinimizeWindow = WIN32_MinimizeWindow;
+    device->RestoreWindow = WIN32_RestoreWindow;
+    device->SetWindowGrab = WIN32_SetWindowGrab;
+    device->DestroyWindow = WIN32_DestroyWindow;
+    device->GetWindowWMInfo = WIN32_GetWindowWMInfo;
+
+    device->free = WIN32_DeleteDevice;
+
+    return device;
+}
+
+VideoBootStrap WIN32_bootstrap = {
+    "win32", "SDL Win32/64 video driver",
+    WIN32_Available, WIN32_CreateDevice
+};
+
+
+int
+WIN32_VideoInit(_THIS)
+{
+    SDL_DisplayMode mode;
+
+    SDL_AddBasicVideoDisplay(NULL);
+    //SDL_AddRenderDriver(0, &SDL_WIN32_RenderDriver);
+
+    SDL_zero(mode);
+    SDL_AddDisplayMode(0, &mode);
+
+    /* We're done! */
+    return 0;
+}
+
+static int
+WIN32_SetDisplayMode(_THIS, const SDL_DisplayMode * mode)
+{
+    SDL_CurrentDisplay.current_mode = *mode;
+    return 0;
+}
+
+void
+WIN32_VideoQuit(_THIS)
+{
+}
+
+/* vim: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/win32/SDL_win32video.h	Mon Jun 26 13:56:56 2006 +0000
@@ -0,0 +1,43 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#ifndef _SDL_win32video_h
+#define _SDL_win32video_h
+
+#include "../SDL_sysvideo.h"
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#include "SDL_win32events.h"
+#include "SDL_win32window.h"
+
+/* Private display data */
+
+struct SDL_PrivateVideoData
+{
+};
+
+#endif /* _SDL_win32video_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/win32/SDL_win32window.c	Mon Jun 26 13:56:56 2006 +0000
@@ -0,0 +1,85 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "../SDL_sysvideo.h"
+
+#include "SDL_win32video.h"
+
+
+int WIN32_CreateWindow(_THIS, SDL_Window * window)
+{
+}
+
+int WIN32_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
+{
+}
+
+void WIN32_SetWindowTitle(_THIS, SDL_Window * window)
+{
+}
+
+void WIN32_SetWindowPosition(_THIS, SDL_Window * window)
+{
+}
+
+void WIN32_SetWindowSize(_THIS, SDL_Window * window)
+{
+}
+
+void WIN32_ShowWindow(_THIS, SDL_Window * window)
+{
+}
+
+void WIN32_HideWindow(_THIS, SDL_Window * window)
+{
+}
+
+void WIN32_RaiseWindow(_THIS, SDL_Window * window)
+{
+}
+
+void WIN32_MaximizeWindow(_THIS, SDL_Window * window)
+{
+}
+
+void WIN32_MinimizeWindow(_THIS, SDL_Window * window)
+{
+}
+
+void WIN32_RestoreWindow(_THIS, SDL_Window * window)
+{
+}
+
+void WIN32_SetWindowGrab(_THIS, SDL_Window * window)
+{
+}
+
+void WIN32_DestroyWindow(_THIS, SDL_Window * window)
+{
+}
+
+SDL_bool WIN32_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
+{
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/win32/SDL_win32window.h	Mon Jun 26 13:56:56 2006 +0000
@@ -0,0 +1,47 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#ifndef _SDL_win32window_h
+#define _SDL_win32window_h
+
+#include "../SDL_sysvideo.h"
+#include "SDL_win32video.h"
+
+extern int WIN32_CreateWindow(_THIS, SDL_Window * window);
+extern int WIN32_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
+extern void WIN32_SetWindowTitle(_THIS, SDL_Window * window);
+extern void WIN32_SetWindowPosition(_THIS, SDL_Window * window);
+extern void WIN32_SetWindowSize(_THIS, SDL_Window * window);
+extern void WIN32_ShowWindow(_THIS, SDL_Window * window);
+extern void WIN32_HideWindow(_THIS, SDL_Window * window);
+extern void WIN32_RaiseWindow(_THIS, SDL_Window * window);
+extern void WIN32_MaximizeWindow(_THIS, SDL_Window * window);
+extern void WIN32_MinimizeWindow(_THIS, SDL_Window * window);
+extern void WIN32_RestoreWindow(_THIS, SDL_Window * window);
+extern void WIN32_SetWindowGrab(_THIS, SDL_Window * window);
+extern void WIN32_DestroyWindow(_THIS, SDL_Window * window);
+extern SDL_bool WIN32_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
+
+#endif /* _SDL_win32window_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/test/Makefile.in	Mon Jun 26 05:27:34 2006 +0000
+++ b/test/Makefile.in	Mon Jun 26 13:56:56 2006 +0000
@@ -7,7 +7,7 @@
 CFLAGS  = @CFLAGS@
 LIBS	= @LIBS@
 
-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)
+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)
 
 all: $(TARGETS)
 
@@ -101,6 +101,9 @@
 testwm$(EXE): $(srcdir)/testwm.c
 	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
 
+testwm2$(EXE): $(srcdir)/testwm.c
+	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
+
 threadwin$(EXE): $(srcdir)/threadwin.c
 	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
 
--- a/test/testsprite.c	Mon Jun 26 05:27:34 2006 +0000
+++ b/test/testsprite.c	Mon Jun 26 13:56:56 2006 +0000
@@ -1,10 +1,6 @@
 /* Simple program:  Move N sprites around on the screen as fast as possible */
 
-#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <math.h>
 #include <time.h>
 
 #include "SDL.h"
--- a/test/testsprite2.c	Mon Jun 26 05:27:34 2006 +0000
+++ b/test/testsprite2.c	Mon Jun 26 13:56:56 2006 +0000
@@ -1,10 +1,6 @@
 /* Simple program:  Move N sprites around on the screen as fast as possible */
 
-#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <math.h>
 #include <time.h>
 
 #include "SDL.h"
@@ -122,7 +118,6 @@
 int
 main(int argc, char *argv[])
 {
-    const SDL_DisplayMode *current_mode;
     int window_w, window_h;
     int i, done;
     SDL_Event event;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testwm2.c	Mon Jun 26 13:56:56 2006 +0000
@@ -0,0 +1,99 @@
+/* Simple program:  Move N sprites around on the screen as fast as possible */
+
+#include "SDL.h"
+
+#define NUM_WINDOWS 2
+#define WINDOW_W    640
+#define WINDOW_H    480
+
+static int num_windows;
+static SDL_WindowID *windows;
+
+/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
+static void
+quit(int rc)
+{
+    if (windows) {
+        SDL_free(windows);
+    }
+    SDL_Quit();
+    exit(rc);
+}
+
+int
+main(int argc, char *argv[])
+{
+    int window_w, window_h;
+    int i, done;
+    SDL_Event event;
+
+    /* Initialize SDL */
+    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
+        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        return (1);
+    }
+
+    num_windows = NUM_WINDOWS;
+    window_w = WINDOW_W;
+    window_h = WINDOW_H;
+    while (argc > 1) {
+        --argc;
+        if (strcmp(argv[argc - 1], "-width") == 0) {
+            window_w = atoi(argv[argc]);
+            --argc;
+        } else if (strcmp(argv[argc - 1], "-height") == 0) {
+            window_h = atoi(argv[argc]);
+            --argc;
+        } else {
+            fprintf(stderr,
+                    "Usage: %s [-width] [-height]\n", argv[0]);
+            quit(1);
+        }
+    }
+
+    /* Set the desktop mode, we don't care what it is */
+    if (SDL_SetDisplayMode(NULL) < 0) {
+        fprintf(stderr, "Couldn't set display mode: %s\n", SDL_GetError());
+        quit(2);
+    }
+
+    /* Create the windows */
+    windows = (SDL_WindowID *) SDL_malloc(num_windows * sizeof(*windows));
+    if (!windows) {
+        fprintf(stderr, "Out of memory!\n");
+        quit(2);
+    }
+    for (i = 0; i < num_windows; ++i) {
+        char title[32];
+
+        SDL_snprintf(title, sizeof(title), "testwm %d", i + 1);
+        windows[i] =
+            SDL_CreateWindow(title, -1, -1, window_w, window_h,
+                             SDL_WINDOW_SHOWN);
+        if (!windows[i]) {
+            fprintf(stderr, "Couldn't create window: %s\n", SDL_GetError());
+            quit(2);
+        }
+    }
+
+    /* Loop, blitting sprites and waiting for a keystroke */
+    done = 0;
+    while (!done) {
+        /* Check for events */
+        while (SDL_PollEvent(&event)) {
+            switch (event.type) {
+            case SDL_KEYDOWN:
+                /* Any keypress quits the app... */
+            case SDL_QUIT:
+                done = 1;
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+    quit(0);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/test/threadwin.c	Mon Jun 26 05:27:34 2006 +0000
+++ b/test/threadwin.c	Mon Jun 26 13:56:56 2006 +0000
@@ -80,7 +80,7 @@
 }
 
 int SDLCALL
-FilterEvents(const SDL_Event * event)
+FilterEvents(SDL_Event * event)
 {
     static int reallyquit = 0;