From 7eea8b93120417281ef1ba977bb8fe4d6efb4ab0 Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Mon, 16 Oct 2006 23:28:33 +0200 Subject: [PATCH] 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 f5900e2bd7a..5b959e7ac1d 100644 --- a/dlls/gdi/driver.c +++ b/dlls/gdi/driver.c @@ -197,6 +197,7 @@ static struct graphics_driver *create_driver( HMODULE module ) /* 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 ec3454cb418..725ed8cac7b 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 375ff9b7be7..6d970252b13 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 a2cee0ba96f..8b7b28a020c 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 b4cecd2f0fe..3a4f5492528 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); @@ -147,15 +146,6 @@ BOOL WINAPI wglCopyContext(HGLRC hglrcSrc, return FALSE; } -/*********************************************************************** - * wglDeleteContext (OPENGL32.@) - */ -BOOL WINAPI wglDeleteContext(HGLRC hglrc) -{ - TRACE("(%p)\n", hglrc); - return wine_wgl.p_wglDeleteContext(hglrc); -} - /*********************************************************************** * wglDescribeLayerPlane (OPENGL32.@) */ @@ -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 */