diff src/video/win32/SDL_win32window.c @ 1913:83420da906a5

Implemented Windows OpenGL support Fixed slowdown enumerating display modes, which was hosing OpenGL as well... Removed SDL_ from the render driver prefixes
author Sam Lantinga <slouken@libsdl.org>
date Mon, 17 Jul 2006 06:47:33 +0000
parents c121d94672cb
children 7177581dc9fa
line wrap: on
line diff
--- a/src/video/win32/SDL_win32window.c	Sun Jul 16 09:34:01 2006 +0000
+++ b/src/video/win32/SDL_win32window.c	Mon Jul 17 06:47:33 2006 +0000
@@ -43,12 +43,14 @@
     }
     data->windowID = window->id;
     data->hwnd = hwnd;
+    data->hdc = GetDC(hwnd);
     data->created = created;
     data->mouse_pressed = SDL_FALSE;
     data->videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata;
 
     /* Associate the data with the window */
     if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
+        ReleaseDC(hwnd, data->hdc);
         SDL_free(data);
         WIN_SetError("SetProp() failed");
         return -1;
@@ -133,7 +135,7 @@
     LPTSTR title = NULL;
     HWND top;
     RECT rect;
-    DWORD style = 0;
+    DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
     int x, y;
     int w, h;
 
@@ -210,6 +212,14 @@
         DestroyWindow(hwnd);
         return -1;
     }
+#ifdef SDL_VIDEO_OPENGL
+    if (window->flags & SDL_WINDOW_OPENGL) {
+        if (WIN_GL_SetupWindow(_this, window) < 0) {
+            WIN_DestroyWindow(_this, window);
+            return -1;
+        }
+    }
+#endif
     return 0;
 }
 
@@ -408,6 +418,12 @@
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
 
     if (data) {
+#ifdef SDL_VIDEO_OPENGL
+        if (window->flags & SDL_WINDOW_OPENGL) {
+            WIN_GL_CleanupWindow(_this, window);
+        }
+#endif
+        ReleaseDC(data->hwnd, data->hdc);
         if (data->created) {
             DestroyWindow(data->hwnd);
         }