Module: wine Branch: master Commit: 8c32dd77a3c50b6030e85bb92b47312f0cabb1ec URL: http://source.winehq.org/git/wine.git/?a=commit;h=8c32dd77a3c50b6030e85bb92b...
Author: Roderick Colenbrander thunderbird2k@gmx.net Date: Sat Oct 14 22:11:33 2006 +0200
wgl: Move wglGetCurrentDC to gdi32.
---
dlls/gdi/gdi32.spec | 1 + dlls/gdi/opengl.c | 21 +++++++++++++++++++++ dlls/opengl32/opengl32.spec | 2 +- dlls/opengl32/wgl.c | 10 ---------- dlls/winex11.drv/opengl.c | 29 +---------------------------- dlls/winex11.drv/winex11.drv.spec | 1 - 6 files changed, 24 insertions(+), 40 deletions(-)
diff --git a/dlls/gdi/gdi32.spec b/dlls/gdi/gdi32.spec index 75b5496..e494c72 100644 --- a/dlls/gdi/gdi32.spec +++ b/dlls/gdi/gdi32.spec @@ -500,6 +500,7 @@ # Wine extensions: OpenGL support # @ stdcall wglCreateContext(long) @ stdcall wglGetCurrentContext() +@ stdcall wglGetCurrentDC() @ stdcall wglMakeCurrent(long long) @ stdcall wglUseFontBitmapsA(long long long long) @ stdcall wglUseFontBitmapsW(long long long long) diff --git a/dlls/gdi/opengl.c b/dlls/gdi/opengl.c index 5203e46..95e09c6 100644 --- a/dlls/gdi/opengl.c +++ b/dlls/gdi/opengl.c @@ -41,6 +41,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl);
static HDC default_hdc = 0;
+typedef struct opengl_context +{ + HDC hdc; +} *OPENGL_Context; + /* We route all wgl functions from opengl32.dll through gdi32.dll to * the display driver. Various wgl calls have a hDC as one of their parameters. * Using DC_GetDCPtr we get access to the functions exported by the driver. @@ -85,6 +90,22 @@ HGLRC WINAPI wglGetCurrentContext(void) }
/*********************************************************************** + * wglGetCurrentDC (OPENGL32.@) + */ +HDC WINAPI wglGetCurrentDC(void) +{ + OPENGL_Context ctx = (OPENGL_Context)wglGetCurrentContext(); + + TRACE(" found context: %p\n", ctx); + if(ctx == NULL) + return NULL; + + /* Retrieve the current DC from the active context */ + TRACE(" returning hdc: %p\n", ctx->hdc); + return ctx->hdc; +} + +/*********************************************************************** * wglMakeCurrent (OPENGL32.@) */ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc) diff --git a/dlls/opengl32/opengl32.spec b/dlls/opengl32/opengl32.spec index 180beb1..611234c 100644 --- a/dlls/opengl32/opengl32.spec +++ b/dlls/opengl32/opengl32.spec @@ -382,7 +382,7 @@ @ stdcall wglDescribeLayerPlane(long long long long ptr) @ stdcall wglDescribePixelFormat(long long long ptr) gdi32.DescribePixelFormat @ stdcall wglGetCurrentContext() gdi32.wglGetCurrentContext -@ stdcall wglGetCurrentDC() +@ stdcall wglGetCurrentDC() gdi32.wglGetCurrentDC @ stub wglGetDefaultProcAddress @ stdcall wglGetLayerPaletteEntries(long long long long ptr) @ stdcall wglGetPixelFormat(long) gdi32.GetPixelFormat diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 52e5a55..6d38721 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -48,7 +48,6 @@ WINE_DECLARE_DEBUG_CHANNEL(opengl);
typedef struct wine_wgl_s { BOOL WINAPI (*p_wglDeleteContext)(HGLRC hglrc); - HDC WINAPI (*p_wglGetCurrentDC)(void); PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc); BOOL WINAPI (*p_wglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
@@ -172,14 +171,6 @@ BOOL WINAPI wglDescribeLayerPlane(HDC hd }
/*********************************************************************** - * wglGetCurrentDC (OPENGL32.@) - */ -HDC WINAPI wglGetCurrentDC(void) { - TRACE("\n"); - return wine_wgl.p_wglGetCurrentDC(); -} - -/*********************************************************************** * wglGetLayerPaletteEntries (OPENGL32.@) */ int WINAPI wglGetLayerPaletteEntries(HDC hdc, @@ -641,7 +632,6 @@ static BOOL process_attach(void)
/* Load WGL function pointers from winex11.drv */ wine_wgl.p_wglDeleteContext = (void *)GetProcAddress(mod, "wglDeleteContext"); - wine_wgl.p_wglGetCurrentDC = (void *)GetProcAddress(mod, "wglGetCurrentDC"); wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod, "wglGetProcAddress"); wine_wgl.p_wglShareLists = (void *)GetProcAddress(mod, "wglShareLists");
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index a81816f..bdd08c4 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1272,27 +1272,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLR return ret; }
-/* OpenGL32 wglGetCurrentDC */ -HDC WINAPI X11DRV_wglGetCurrentDC(void) { - GLXContext gl_ctx; - Wine_GLContext *ret; - - TRACE("()\n"); - - wine_tsx11_lock(); - gl_ctx = pglXGetCurrentContext(); - ret = get_context_from_GLXContext(gl_ctx); - wine_tsx11_unlock(); - - if (ret) { - TRACE(" returning %p (GL context %p - Wine context %p)\n", ret->hdc, gl_ctx, ret); - return ret->hdc; - } else { - TRACE(" no Wine context found for GLX context %p\n", gl_ctx); - return 0; - } -} - /* OpenGL32 wglGetCurrentReadDCARB */ static HDC WINAPI X11DRV_wglGetCurrentReadDCARB(void) { @@ -2353,7 +2332,7 @@ static GLboolean WINAPI X11DRV_wglBindTe object->render_ctx = wglCreateContext(object->render_hdc); do_init = 1; } - object->prev_hdc = X11DRV_wglGetCurrentDC(); + object->prev_hdc = wglGetCurrentDC(); object->prev_ctx = wglGetCurrentContext(); /* FIXME: This is routed through gdi32.dll to winex11.drv, replace this with GLX calls */ wglMakeCurrent(object->render_hdc, object->render_ctx); @@ -2784,12 +2763,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLR return FALSE; }
-/* OpenGL32 wglGetCurrentDC */ -HDC WINAPI X11DRV_wglGetCurrentDC(void) { - ERR_(opengl)("No OpenGL support compiled in.\n"); - return 0; -} - /* OpenGL32: wglGetProcAddress */ PROC X11DRV_wglGetProcAddress(LPCSTR lpszProc) { ERR_(opengl)("No OpenGL support compiled in.\n"); diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 4cfc0f9..9b3b0a5 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -131,7 +131,6 @@ # XIM # OpenGL @ cdecl wglCreateContext(long) X11DRV_wglCreateContext @ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext -@ cdecl wglGetCurrentDC() X11DRV_wglGetCurrentDC @ cdecl wglGetIntegerv(long ptr) X11DRV_wglGetIntegerv @ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress @ cdecl wglMakeCurrent(long long) X11DRV_wglMakeCurrent