changeset 1720:a1ebb17f9c52 SDL-1.3

Cleaned up a bunch of warnings, started adding Win32 event support
author Sam Lantinga <slouken@libsdl.org>
date Fri, 30 Jun 2006 05:42:49 +0000
parents 5b9f50c957ed
children 1cc762cafff8
files include/SDL_config_win32.h include/SDL_video.h src/SDL_compat.c src/audio/SDL_mixer_MMX_VC.c src/events/SDL_events_c.h src/events/SDL_keyboard.c src/events/SDL_keyboard_c.h src/events/SDL_mouse.c src/events/SDL_windowevents_c.h src/video/SDL_blit_A.c src/video/SDL_renderer_sw.c src/video/SDL_surface.c src/video/SDL_sysvideo.h src/video/SDL_video.c src/video/dummy/SDL_nullrender.c src/video/dummy/SDL_nullvideo.c src/video/dummy/SDL_nullvideo.h src/video/win32/SDL_win32keyboard.c src/video/win32/SDL_win32keyboard.h src/video/win32/SDL_win32mouse.c src/video/win32/SDL_win32mouse.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
diffstat 25 files changed, 283 insertions(+), 106 deletions(-) [+]
line wrap: on
line diff
--- a/include/SDL_config_win32.h	Wed Jun 28 08:12:07 2006 +0000
+++ b/include/SDL_config_win32.h	Fri Jun 30 05:42:49 2006 +0000
@@ -133,7 +133,7 @@
 #ifdef _WIN32_WCE
 #define SDL_JOYSTICK_DISABLED   1
 #else
-#define SDL_JOYSTICK_DINPUT	1
+#define SDL_JOYSTICK_WINMM	1
 #endif
 
 /* Enable various shared object loading systems */
@@ -150,17 +150,8 @@
 #endif
 
 /* Enable various video drivers */
-#ifdef _WIN32_WCE
-#define SDL_VIDEO_DRIVER_GAPI	1
-#endif
-#ifndef _WIN32_WCE
-#define SDL_VIDEO_DRIVER_DDRAW	1
-#endif
 #define SDL_VIDEO_DRIVER_DUMMY	1
-#ifndef _WIN32_WCE
-#define SDL_VIDEO_DRIVER_GLSDL	1
-#endif
-#define SDL_VIDEO_DRIVER_WINDIB	1
+#define SDL_VIDEO_DRIVER_WIN32	1
 
 /* Enable OpenGL support */
 #ifndef _WIN32_WCE
--- a/include/SDL_video.h	Wed Jun 28 08:12:07 2006 +0000
+++ b/include/SDL_video.h	Fri Jun 30 05:42:49 2006 +0000
@@ -718,6 +718,18 @@
 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID);
 
 /**
+ * \fn SDL_bool SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info)
+ *
+ * \brief Get driver specific information about a window.
+ *
+ * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
+ */
+struct SDL_SysWMinfo;
+extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
+                                                     struct SDL_SysWMinfo
+                                                     *info);
+
+/**
  * \fn void SDL_DestroyWindow(SDL_WindowID windowID)
  *
  * \brief Destroy a window.
--- a/src/SDL_compat.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/SDL_compat.c	Fri Jun 30 05:42:49 2006 +0000
@@ -26,6 +26,7 @@
 #include "SDL.h"
 #include "SDL_syswm.h"
 
+#include "video/SDL_sysvideo.h"
 #include "video/SDL_pixels_c.h"
 
 
@@ -94,7 +95,7 @@
             if (!mode->format) {
                 return bpp;
             }
-            if (SDL_BITSPERPIXEL(mode->format) >= bpp) {
+            if (SDL_BITSPERPIXEL(mode->format) >= (Uint32) bpp) {
                 actual_bpp = SDL_BITSPERPIXEL(mode->format);
             }
         }
@@ -118,6 +119,7 @@
 
     /* Memory leak, but this is a compatibility function, who cares? */
     nmodes = 0;
+    modes = NULL;
     for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
         const SDL_DisplayMode *mode = SDL_GetDisplayMode(i);
         if (!mode->w || !mode->h) {
@@ -243,6 +245,7 @@
     if (userdata == SDL_VideoSurface) {
         return SDL_SetDisplayPalette(palette->colors, 0, palette->ncolors);
     }
+    return 0;
 }
 
 SDL_Surface *
@@ -251,11 +254,9 @@
     int (*filter) (SDL_Event * event);
     const SDL_DisplayMode *desktop_mode;
     SDL_DisplayMode mode;
-    int i;
     Uint32 window_flags;
     Uint32 desktop_format;
     Uint32 desired_format;
-    Uint32 texture_format;
     Uint32 surface_flags;
 
     if (!SDL_GetVideoDevice()) {
@@ -641,6 +642,7 @@
 SDL_WM_IconifyWindow(void)
 {
     SDL_MinimizeWindow(SDL_VideoWindow);
+    return 0;
 }
 
 int
@@ -695,7 +697,7 @@
 SDL_SetPalette(SDL_Surface * surface, int flags, const SDL_Color * colors,
                int firstcolor, int ncolors)
 {
-    SDL_SetColors(surface, colors, firstcolor, ncolors);
+    return SDL_SetColors(surface, colors, firstcolor, ncolors);
 }
 
 int
@@ -1333,6 +1335,7 @@
         return -1;
     }
     SDL_RenderPresent();
+    return 0;
 }
 
 void
--- a/src/audio/SDL_mixer_MMX_VC.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/audio/SDL_mixer_MMX_VC.c	Fri Jun 30 05:42:49 2006 +0000
@@ -40,14 +40,19 @@
 void
 SDL_MixAudio_MMX_S16_VC(char *dst, char *src, unsigned int nSize, int volume)
 {
+	/* *INDENT-OFF* */
     __asm {
-
-        push edi push esi push ebx mov edi, dst // edi = dst
+          push edi
+          push esi
+		  push ebx
+		  mov edi, dst          // edi = dst
           mov esi, src          // esi = src
           mov eax, volume       // eax = volume
           mov ebx, nSize        // ebx = size
           shr ebx, 4            // process 16 bytes per iteration = 8 samples
-          jz endS16 pxor mm0, mm0 movd mm0, eax //%%eax,%%mm0
+          jz endS16
+		  pxor mm0, mm0
+		  movd mm0, eax         //%%eax,%%mm0
           movq mm1, mm0         //%%mm0,%%mm1
           psllq mm0, 16         //$16,%%mm0
           por mm0, mm1          //%%mm1,%%mm0
@@ -58,13 +63,14 @@
 #ifndef __WATCOMC__
           align 16
 #endif
-          mixloopS16:movq mm1,[esi]     //(%%esi),%%mm1\n" // mm1 = a|b|c|d
-        movq mm2, mm1           //%%mm1,%%mm2\n" // mm2 = a|b|c|d
+      mixloopS16:
+		  movq mm1,[esi]        //(%%esi),%%mm1\n" // mm1 = a|b|c|d
+          movq mm2, mm1         //%%mm1,%%mm2\n" // mm2 = a|b|c|d
           movq mm4,[esi + 8]    //8(%%esi),%%mm4\n" // mm4 = e|f|g|h
             // pre charger le buffer dst dans mm7
-        movq mm7,[edi]          //(%%edi),%%mm7\n" // mm7 = dst[0]"
+          movq mm7,[edi]        //(%%edi),%%mm7\n" // mm7 = dst[0]"
             // multiplier par le volume
-        pmullw mm1, mm0         //%%mm0,%%mm1\n" // mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v)
+          pmullw mm1, mm0       //%%mm0,%%mm1\n" // mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v)
           pmulhw mm2, mm0       //%%mm0,%%mm2\n" // mm2 = h(a*v)|h(b*v)|h(c*v)|h(d*v)
           movq mm5, mm4         //%%mm4,%%mm5\n" // mm5 = e|f|g|h
           pmullw mm4, mm0       //%%mm0,%%mm4\n" // mm4 = l(e*v)|l(f*v)|l(g*v)|l(h*v)
@@ -78,7 +84,7 @@
             // pre charger le buffer dst dans mm5
           movq mm5,[edi + 8]    //8(%%edi),%%mm5\n" // mm5 = dst[1]
             // diviser par 128
-        psrad mm1, 7            //$7,%%mm1\n" // mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME
+          psrad mm1, 7          //$7,%%mm1\n" // mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME
           add esi, 16           //$16,%%esi\n"
           psrad mm3, 7          //$7,%%mm3\n" // mm3 = c*v/128|d*v/128
           psrad mm4, 7          //$7,%%mm4\n" // mm4 = e*v/128|f*v/128
@@ -93,8 +99,14 @@
           movq[edi + 8], mm6    //%%mm6,8(%%edi)\n"
           add edi, 16           //$16,%%edi\n"
           dec ebx               //%%ebx\n"
-      jnz mixloopS16 ends16:emms pop ebx pop esi pop edi}
-
+          jnz mixloopS16
+	ends16:
+		  emms
+          pop ebx
+		  pop esi
+		  pop edi
+	}
+	/* *INDENT-ON* */
 }
 
 ////////////////////////////////////////////////
@@ -104,9 +116,13 @@
 void
 SDL_MixAudio_MMX_S8_VC(char *dst, char *src, unsigned int nSize, int volume)
 {
+	/* *INDENT-OFF* */
     _asm {
 
-        push edi push esi push ebx mov edi, dst //movl  %0,%%edi        // edi = dst
+          push edi
+          push esi
+		  push ebx
+		  mov edi, dst          //%0,%%edi      // edi = dst
           mov esi, src          //%1,%%esi      // esi = src
           mov eax, volume       //%3,%%eax      // eax = volume
           movd mm0, eax         //%%eax,%%mm0
@@ -124,15 +140,16 @@
 #ifndef __WATCOMC__
           align 16
 #endif
-          mixloopS8:pxor mm2, mm2       //%%mm2,%%mm2           // mm2 = 0
+      mixloopS8:
+		  pxor mm2, mm2         //%%mm2,%%mm2           // mm2 = 0
           movq mm1,[esi]        //(%%esi),%%mm1 // mm1 = a|b|c|d|e|f|g|h
-        movq mm3, mm1           //%%mm1,%%mm3   // mm3 = a|b|c|d|e|f|g|h
+          movq mm3, mm1         //%%mm1,%%mm3   // mm3 = a|b|c|d|e|f|g|h
             // on va faire le "sign extension" en faisant un cmp avec 0 qui retourne 1 si <0, 0 si >0
           pcmpgtb mm2, mm1      //%%mm1,%%mm2   // mm2 = 11111111|00000000|00000000....
           punpckhbw mm1, mm2    //%%mm2,%%mm1   // mm1 = 0|a|0|b|0|c|0|d
           punpcklbw mm3, mm2    //%%mm2,%%mm3   // mm3 = 0|e|0|f|0|g|0|h
           movq mm2,[edi]        //(%%edi),%%mm2 // mm2 = destination
-        pmullw mm1, mm0         //%%mm0,%%mm1   // mm1 = v*a|v*b|v*c|v*d
+          pmullw mm1, mm0       //%%mm0,%%mm1   // mm1 = v*a|v*b|v*c|v*d
           add esi, 8            //$8,%%esi
           pmullw mm3, mm0       //%%mm0,%%mm3   // mm3 = v*e|v*f|v*g|v*h
           psraw mm1, 7          //$7,%%mm1              // mm1 = v*a/128|v*b/128|v*c/128|v*d/128 
@@ -142,8 +159,16 @@
           movq[edi], mm3        //%%mm3,(%%edi) // store back to ram
           add edi, 8            //$8,%%edi
           dec ebx               //%%ebx
-      jnz mixloopS8 endS8:emms pop ebx pop esi pop edi}
+          jnz mixloopS8
+      endS8:
+		  emms
+          pop ebx
+		  pop esi
+		  pop edi
+	}
+	/* *INDENT-ON* */
 }
 
 #endif                          /* SDL_ASSEMBLY_ROUTINES */
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/events/SDL_events_c.h	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/events/SDL_events_c.h	Fri Jun 30 05:42:49 2006 +0000
@@ -39,11 +39,6 @@
 extern int SDL_SendQuit(void);
 extern void SDL_QuitQuit(void);
 
-extern int SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent,
-                               int data1, int data2);
-
-extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
-
 /* The event filter function */
 extern SDL_EventFilter SDL_EventOK;
 
--- a/src/events/SDL_keyboard.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/events/SDL_keyboard.c	Fri Jun 30 05:42:49 2006 +0000
@@ -291,8 +291,6 @@
 SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index)
 {
     SDL_Keyboard **keyboards;
-    SDL_Cursor *cursor;
-    int selected_keyboard;
 
     /* Add the keyboard to the list of keyboards */
     if (index < 0 || index >= SDL_num_keyboards || SDL_keyboards[index]) {
--- a/src/events/SDL_keyboard_c.h	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/events/SDL_keyboard_c.h	Fri Jun 30 05:42:49 2006 +0000
@@ -24,6 +24,9 @@
 #ifndef _SDL_keyboard_c_h
 #define _SDL_keyboard_c_h
 
+#include "SDL_keysym.h"
+#include "SDL_events.h"
+
 typedef struct SDL_Keyboard SDL_Keyboard;
 
 struct SDL_Keyboard
--- a/src/events/SDL_mouse.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/events/SDL_mouse.c	Fri Jun 30 05:42:49 2006 +0000
@@ -53,7 +53,6 @@
 SDL_AddMouse(const SDL_Mouse * mouse, int index)
 {
     SDL_Mouse **mice;
-    SDL_Cursor *cursor;
     int selected_mouse;
 
     /* Add the mouse to the list of mice */
@@ -398,9 +397,7 @@
         return NULL;
     }
     for (y = 0; y < h; ++y) {
-        pixel =
-            (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch +
-                        x * 4);
+        pixel = (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch);
         for (x = 0; x < w; ++x) {
             if ((x % 8) == 0) {
                 datab = *data++;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/events/SDL_windowevents_c.h	Fri Jun 30 05:42:49 2006 +0000
@@ -0,0 +1,34 @@
+/*
+    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_windowevents_c_h
+#define _SDL_windowevents_c_h
+
+extern int SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent,
+                               int data1, int data2);
+
+extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
+
+#endif /* _SDL_windowevents_c_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_blit_A.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/SDL_blit_A.c	Fri Jun 30 05:42:49 2006 +0000
@@ -617,7 +617,9 @@
     __m64 src1, dst1, mm_alpha, mm_zero, dmask;
 
     mm_zero = _mm_setzero_si64();       /* 0 -> mm_zero */
-    multmask = ~(0xFFFFi 64 << (ashift * 2));
+	/* *INDENT-OFF* */
+	multmask = ~(0xFFFFI64 << (ashift * 2));
+	/* *INDENT-ON* */
     dmask = *(__m64 *) & multmask;      /* dst alpha mask -> dmask */
 
     while (height--) {
@@ -1753,7 +1755,9 @@
     __m64 src1, dst1, mm_alpha, mm_zero, dmask;
 
     mm_zero = _mm_setzero_si64();       /* 0 -> mm_zero */
-    multmask = ~(0xFFFFi 64 << (ashift * 2));
+	/* *INDENT-OFF* */
+    multmask = ~(0xFFFFI64 << (ashift * 2));
+	/* *INDENT-ON* */
     dmask = *(__m64 *) & multmask;      /* dst alpha mask -> dmask */
 
     while (height--) {
--- a/src/video/SDL_renderer_sw.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/SDL_renderer_sw.c	Fri Jun 30 05:42:49 2006 +0000
@@ -54,8 +54,8 @@
                                 const SDL_Rect * rects);
 static void SDL_SW_SelectRenderTexture(SDL_Renderer * renderer,
                                        SDL_Texture * texture);
-static void SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
-                              Uint32 color);
+static int SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
+                             Uint32 color);
 static int SDL_SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
                              const SDL_Rect * srcrect,
                              const SDL_Rect * dstrect, int blendMode,
@@ -355,7 +355,7 @@
     }
 }
 
-static void
+static int
 SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
                   Uint32 color)
 {
@@ -369,7 +369,7 @@
     b = (Uint8) (color & 0xFF);
     color = SDL_MapRGBA(data->target->format, r, g, b, a);
 
-    SDL_FillRect(data->target, &real_rect, color);
+    return SDL_FillRect(data->target, &real_rect, color);
 }
 
 static int
--- a/src/video/SDL_surface.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/SDL_surface.c	Fri Jun 30 05:42:49 2006 +0000
@@ -39,7 +39,6 @@
                      int width, int height, int depth,
                      Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
 {
-    SDL_Surface *screen;
     SDL_Surface *surface;
 
     /* FIXME!! */
--- a/src/video/SDL_sysvideo.h	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/SDL_sysvideo.h	Fri Jun 30 05:42:49 2006 +0000
@@ -25,9 +25,6 @@
 #define _SDL_sysvideo_h
 
 #include "SDL_mouse.h"
-#define SDL_PROTOTYPES_ONLY
-#include "SDL_syswm.h"
-#undef SDL_PROTOTYPES_ONLY
 
 /* The SDL video driver */
 
@@ -78,8 +75,8 @@
                           int numrects, const SDL_Rect * rects);
     void (*SelectRenderTexture) (SDL_Renderer * renderer,
                                  SDL_Texture * texture);
-    void (*RenderFill) (SDL_Renderer * renderer, const SDL_Rect * rect,
-                        Uint32 color);
+    int (*RenderFill) (SDL_Renderer * renderer, const SDL_Rect * rect,
+                       Uint32 color);
     int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
                        const SDL_Rect * srcrect, const SDL_Rect * dstrect,
                        int blendMode, int scaleMode);
@@ -208,7 +205,7 @@
 
     /* Get some platform dependent window information */
       SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
-                                  SDL_SysWMinfo * info);
+                                  struct SDL_SysWMinfo * info);
 
     /* Reverse the effects VideoInit() -- called if VideoInit() fails
        or if the application is shutting down the video subsystem.
@@ -300,7 +297,7 @@
 
     /* * * */
     /* Data private to this driver */
-    struct SDL_PrivateVideoData *hidden;
+    void *driverdata;
     struct SDL_PrivateGLData *gl_data;
 
     /* * * */
--- a/src/video/SDL_video.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/SDL_video.c	Fri Jun 30 05:42:49 2006 +0000
@@ -177,8 +177,6 @@
     SDL_VideoDevice *video;
     int index;
     int i;
-    int bpp;
-    Uint32 Rmask, Gmask, Bmask, Amask;
 
     /* Toggle the event thread flags, based on OS requirements */
 #if defined(MUST_THREAD_EVENTS)
@@ -524,7 +522,7 @@
 {
     SDL_VideoDisplay *display;
     SDL_DisplayMode display_mode;
-    int i, ncolors;
+    int ncolors;
 
     if (!_this) {
         SDL_SetError("Video subsystem has not been initialized");
@@ -600,14 +598,13 @@
         SDL_SetError("Video subsystem has not been initialized");
         return -1;
     }
-    if (!SDL_CurrentDisplay.palette) {
+    palette = SDL_CurrentDisplay.palette;
+    if (!palette) {
         SDL_SetError("Display mode does not have a palette");
         return -1;
     }
 
-    status =
-        SDL_SetPaletteColors(SDL_CurrentDisplay.palette, colors, firstcolor,
-                             ncolors);
+    status = SDL_SetPaletteColors(palette, colors, firstcolor, ncolors);
 
     if (_this->SetDisplayPalette) {
         if (_this->SetDisplayPalette(_this, palette) < 0) {
@@ -1222,7 +1219,6 @@
     SDL_TextureID textureID;
     Uint32 surface_flags = surface->flags;
     SDL_PixelFormat *fmt = surface->format;
-    Uint32 colorkey;
     Uint8 alpha;
     SDL_Rect bounds;
     SDL_Surface dst;
@@ -1328,10 +1324,6 @@
     SDL_LowerBlit(surface, &bounds, &dst, &bounds);
 
     /* Clean up the original surface */
-    if ((surface_flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
-        Uint32 cflags = surface_flags & (SDL_SRCCOLORKEY | SDL_RLEACCELOK);
-        SDL_SetColorKey(surface, cflags, colorkey);
-    }
     if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
         Uint32 aflags = surface_flags & (SDL_SRCALPHA | SDL_RLEACCELOK);
         if (fmt->Amask) {
@@ -1524,7 +1516,7 @@
     if (!renderer->UnlockTexture) {
         return;
     }
-    return renderer->UnlockTexture(renderer, texture);
+    renderer->UnlockTexture(renderer, texture);
 }
 
 void
@@ -1585,7 +1577,7 @@
         rect = &full_rect;
     }
 
-    renderer->RenderFill(renderer, rect, color);
+    return renderer->RenderFill(renderer, rect, color);
 }
 
 int
@@ -1598,7 +1590,7 @@
     SDL_Rect full_dstrect;
 
     if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
-        return;
+        return -1;
     }
 
     renderer = SDL_CurrentDisplay.current_renderer;
@@ -2042,7 +2034,7 @@
 #endif
 
 SDL_bool
-SDL_GetWindowWMInfo(SDL_WindowID windowID, SDL_SysWMinfo * info)
+SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo *info)
 {
     SDL_Window *window = SDL_GetWindowFromID(windowID);
 
--- a/src/video/dummy/SDL_nullrender.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/dummy/SDL_nullrender.c	Fri Jun 30 05:42:49 2006 +0000
@@ -50,7 +50,7 @@
      SDL_TextureBlendMode_None,
      SDL_TextureScaleMode_None,
      0,
-     {},
+     {0},
      0,
      0}
 };
@@ -67,7 +67,6 @@
     SDL_DisplayMode *displayMode = &display->current_mode;
     SDL_Renderer *renderer;
     SDL_DUMMY_RenderData *data;
-    int i, n;
     int bpp;
     Uint32 Rmask, Gmask, Bmask, Amask;
 
--- a/src/video/dummy/SDL_nullvideo.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/dummy/SDL_nullvideo.c	Fri Jun 30 05:42:49 2006 +0000
@@ -69,7 +69,6 @@
 static void
 DUMMY_DeleteDevice(SDL_VideoDevice * device)
 {
-    SDL_free(device->hidden);
     SDL_free(device);
 }
 
@@ -79,20 +78,14 @@
     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)) {
+    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+    if (!device) {
         SDL_OutOfMemory();
         if (device) {
             SDL_free(device);
         }
         return (0);
     }
-    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
 
     /* Set the function pointers */
     device->VideoInit = DUMMY_VideoInit;
--- a/src/video/dummy/SDL_nullvideo.h	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/dummy/SDL_nullvideo.h	Fri Jun 30 05:42:49 2006 +0000
@@ -26,17 +26,6 @@
 
 #include "../SDL_sysvideo.h"
 
-/* Hidden "this" pointer for the video functions */
-#define _THIS	SDL_VideoDevice *_this
-
-
-/* Private display data */
-
-struct SDL_PrivateVideoData
-{
-    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_win32keyboard.c	Fri Jun 30 05:42:49 2006 +0000
@@ -0,0 +1,38 @@
+/*
+    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"
+
+#include "../../events/SDL_keyboard_c.h"
+
+void
+WIN_AddKeyboard(_THIS)
+{
+    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+    SDL_Keyboard keyboard;
+
+    SDL_zero(keyboard);
+    data->keyboard = SDL_AddKeyboard(&keyboard, -1);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/win32/SDL_win32keyboard.h	Fri Jun 30 05:42:49 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"
+
+#ifndef _SDL_win32keyboard_h
+#define _SDL_win32keyboard_h
+
+extern void WIN_AddKeyboard(_THIS);
+
+#endif /* _SDL_win32keyboard_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/win32/SDL_win32mouse.c	Fri Jun 30 05:42:49 2006 +0000
@@ -0,0 +1,38 @@
+/*
+    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"
+
+#include "../../events/SDL_mouse_c.h"
+
+void
+WIN_AddMouse(_THIS)
+{
+    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+    SDL_Mouse mouse;
+
+    SDL_zero(mouse);
+    data->mouse = SDL_AddMouse(&mouse, -1);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/win32/SDL_win32mouse.h	Fri Jun 30 05:42:49 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"
+
+#ifndef _SDL_win32mouse_h
+#define _SDL_win32mouse_h
+
+extern void WIN_AddMouse(_THIS);
+
+#endif /* _SDL_win32mouse_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/win32/SDL_win32video.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/win32/SDL_win32video.c	Fri Jun 30 05:42:49 2006 +0000
@@ -21,6 +21,7 @@
 */
 #include "SDL_config.h"
 
+#include "SDL_main.h"
 #include "SDL_video.h"
 #include "SDL_mouse.h"
 #include "../SDL_sysvideo.h"
@@ -47,7 +48,7 @@
 WIN_DeleteDevice(SDL_VideoDevice * device)
 {
     SDL_UnregisterApp();
-    SDL_free(device->hidden);
+    SDL_free(device->driverdata);
     SDL_free(device);
 }
 
@@ -59,20 +60,18 @@
     SDL_RegisterApp(NULL, 0, NULL);
 
     /* Initialize all variables that we clean on shutdown */
-    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
+    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
     if (device) {
-        SDL_memset(device, 0, (sizeof *device));
-        device->hidden = (struct SDL_PrivateVideoData *)
-            SDL_malloc((sizeof *device->hidden));
+        device->driverdata =
+            (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
     }
-    if ((device == NULL) || (device->hidden == NULL)) {
+    if (!device || !device->driverdata) {
         SDL_OutOfMemory();
         if (device) {
             SDL_free(device);
         }
         return NULL;
     }
-    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
 
     /* Set the function pointers */
     device->VideoInit = WIN_VideoInit;
@@ -118,6 +117,9 @@
     SDL_zero(mode);
     SDL_AddDisplayMode(0, &mode);
 
+    WIN_AddKeyboard(_this);
+    WIN_AddMouse(_this);
+
     /* We're done! */
     return 0;
 }
--- a/src/video/win32/SDL_win32video.h	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/win32/SDL_win32video.h	Fri Jun 30 05:42:49 2006 +0000
@@ -31,6 +31,8 @@
 #include <windows.h>
 
 #include "SDL_win32events.h"
+#include "SDL_win32keyboard.h"
+#include "SDL_win32mouse.h"
 #include "SDL_win32window.h"
 
 #ifdef UNICODE
@@ -43,9 +45,11 @@
 
 /* Private display data */
 
-struct SDL_PrivateVideoData
+typedef struct
 {
-};
+    int mouse;
+    int keyboard;
+} SDL_VideoData;
 
 #endif /* _SDL_win32video_h */
 
--- a/src/video/win32/SDL_win32window.c	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/win32/SDL_win32window.c	Fri Jun 30 05:42:49 2006 +0000
@@ -25,6 +25,9 @@
 
 #include "SDL_win32video.h"
 
+/* This is included after SDL_win32video.h, which includes windows.h */
+#include "SDL_syswm.h"
+
 
 static int
 SetupWindowData(SDL_Window * window, HWND hwnd, BOOL created)
@@ -59,6 +62,8 @@
     /* Fill in the SDL window with the window data */
     {
         POINT point;
+        point.x = 0;
+        point.y = 0;
         if (ClientToScreen(hwnd, &point)) {
             window->x = point.x;
             window->y = point.y;
@@ -385,8 +390,6 @@
 WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
 {
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
-/* FIXME! */
-#if 0
     if (info->version.major <= SDL_MAJOR_VERSION) {
         info->window = hwnd;
         /* FIXME! */
@@ -397,7 +400,6 @@
                      SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
         return SDL_FALSE;
     }
-#endif
 }
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/win32/SDL_win32window.h	Wed Jun 28 08:12:07 2006 +0000
+++ b/src/video/win32/SDL_win32window.h	Fri Jun 30 05:42:49 2006 +0000
@@ -49,7 +49,7 @@
 extern void WIN_SetWindowGrab(_THIS, SDL_Window * window);
 extern void WIN_DestroyWindow(_THIS, SDL_Window * window);
 extern SDL_bool WIN_GetWindowWMInfo(_THIS, SDL_Window * window,
-                                    SDL_SysWMinfo * info);
+                                    struct SDL_SysWMinfo *info);
 
 #endif /* _SDL_win32window_h */