Roderick Colenbrander : wgl: Move wglDeleteContext to gdi32.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Oct 17 06:12:25 CDT 2006


Module: wine
Branch: master
Commit: 7eea8b93120417281ef1ba977bb8fe4d6efb4ab0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7eea8b93120417281ef1ba977bb8fe4d6efb4ab0

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Mon Oct 16 23:28:33 2006 +0200

wgl: Move wglDeleteContext to gdi32.

---

 dlls/gdi/driver.c           |    1 +
 dlls/gdi/gdi_private.h      |    1 +
 dlls/gdi/opengl.c           |   25 +++++++++++++++++++++++++
 dlls/opengl32/opengl32.spec |    2 +-
 dlls/opengl32/wgl.c         |   11 -----------
 5 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/dlls/gdi/driver.c b/dlls/gdi/driver.c
index f5900e2..5b959e7 100644
--- a/dlls/gdi/driver.c
+++ b/dlls/gdi/driver.c
@@ -197,6 +197,7 @@ #define GET_FUNC(name) driver->funcs.p##
 
         /* OpenGL32 */
         GET_FUNC(wglCreateContext);
+        GET_FUNC(wglDeleteContext);
         GET_FUNC(wglMakeCurrent);
         GET_FUNC(wglShareLists);
         GET_FUNC(wglUseFontBitmapsA);
diff --git a/dlls/gdi/gdi_private.h b/dlls/gdi/gdi_private.h
index ec3454c..725ed8c 100644
--- a/dlls/gdi/gdi_private.h
+++ b/dlls/gdi/gdi_private.h
@@ -185,6 +185,7 @@ typedef struct tagDC_FUNCS
 
     /* OpenGL32 */
     HGLRC    (*pwglCreateContext)(PHYSDEV);
+    BOOL     (*pwglDeleteContext)(HGLRC);
     BOOL     (*pwglMakeCurrent)(PHYSDEV, HGLRC);
     BOOL     (*pwglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
     BOOL     (*pwglUseFontBitmapsA)(PHYSDEV, DWORD, DWORD, DWORD);
diff --git a/dlls/gdi/opengl.c b/dlls/gdi/opengl.c
index 375ff9b..6d97025 100644
--- a/dlls/gdi/opengl.c
+++ b/dlls/gdi/opengl.c
@@ -79,6 +79,31 @@ HGLRC WINAPI wglCreateContext(HDC hdc)
     return ret;
 }
 
+
+/***********************************************************************
+ *		wglDeleteContext (OPENGL32.@)
+ */
+BOOL WINAPI wglDeleteContext(HGLRC hglrc)
+{
+    DC *dc;
+    BOOL ret = FALSE;
+    OPENGL_Context ctx = (OPENGL_Context)hglrc;
+
+    TRACE("hglrc: (%p)\n", hglrc);
+    if(ctx == NULL)
+        return FALSE;
+
+    /* Retrieve the HDC associated with the context to access the display driver */
+    dc = DC_GetDCPtr(ctx->hdc);
+    if (!dc) return FALSE;
+
+    if (!dc->funcs->pwglDeleteContext) FIXME(" :stub\n");
+    else ret = dc->funcs->pwglDeleteContext(hglrc);
+
+    GDI_ReleaseObj(ctx->hdc);
+    return ret;
+}
+
 /***********************************************************************
  *		wglGetCurrentContext (OPENGL32.@)
  */
diff --git a/dlls/opengl32/opengl32.spec b/dlls/opengl32/opengl32.spec
index a2cee0b..8b7b28a 100644
--- a/dlls/opengl32/opengl32.spec
+++ b/dlls/opengl32/opengl32.spec
@@ -378,7 +378,7 @@
 @  stdcall wglCopyContext(long long long)
 @  stdcall wglCreateContext(long) gdi32.wglCreateContext
 @  stdcall wglCreateLayerContext(long long)
-@  stdcall wglDeleteContext(long)
+@  stdcall wglDeleteContext(long) gdi32.wglDeleteContext
 @  stdcall wglDescribeLayerPlane(long long long long ptr)
 @  stdcall wglDescribePixelFormat(long long long ptr) gdi32.DescribePixelFormat
 @  stdcall wglGetCurrentContext() gdi32.wglGetCurrentContext
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index b4cecd2..3a4f549 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -47,7 +47,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl);
 WINE_DECLARE_DEBUG_CHANNEL(opengl);
 
 typedef struct wine_wgl_s {
-    BOOL WINAPI  (*p_wglDeleteContext)(HGLRC hglrc);
     PROC WINAPI  (*p_wglGetProcAddress)(LPCSTR  lpszProc);
 
     void WINAPI  (*p_wglGetIntegerv)(GLenum pname, GLint* params);
@@ -148,15 +147,6 @@ BOOL WINAPI wglCopyContext(HGLRC hglrcSr
 }
 
 /***********************************************************************
- *		wglDeleteContext (OPENGL32.@)
- */
-BOOL WINAPI wglDeleteContext(HGLRC hglrc)
-{
-    TRACE("(%p)\n", hglrc);
-    return wine_wgl.p_wglDeleteContext(hglrc);
-}
-
-/***********************************************************************
  *		wglDescribeLayerPlane (OPENGL32.@)
  */
 BOOL WINAPI wglDescribeLayerPlane(HDC hdc,
@@ -622,7 +612,6 @@ static BOOL process_attach(void)
   wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
 
   /* Load WGL function pointers from winex11.drv */
-  wine_wgl.p_wglDeleteContext = (void *)GetProcAddress(mod, "wglDeleteContext");
   wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod, "wglGetProcAddress");
 
   /* Interal WGL function */




More information about the wine-cvs mailing list