diff src/video/win32/SDL_win32video.c @ 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 ed4d4f1ea201
children 6c63fc2bd986
line wrap: on
line diff
--- 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;
 }