Commit 8c32dd77 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wgl: Move wglGetCurrentDC to gdi32.

parent ad7bc71c
...@@ -500,6 +500,7 @@ ...@@ -500,6 +500,7 @@
# #
@ stdcall wglCreateContext(long) @ stdcall wglCreateContext(long)
@ stdcall wglGetCurrentContext() @ stdcall wglGetCurrentContext()
@ stdcall wglGetCurrentDC()
@ stdcall wglMakeCurrent(long long) @ stdcall wglMakeCurrent(long long)
@ stdcall wglUseFontBitmapsA(long long long long) @ stdcall wglUseFontBitmapsA(long long long long)
@ stdcall wglUseFontBitmapsW(long long long long) @ stdcall wglUseFontBitmapsW(long long long long)
......
...@@ -41,6 +41,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl); ...@@ -41,6 +41,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl);
static HDC default_hdc = 0; 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 /* 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. * 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. * Using DC_GetDCPtr we get access to the functions exported by the driver.
...@@ -85,6 +90,22 @@ HGLRC WINAPI wglGetCurrentContext(void) ...@@ -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.@) * wglMakeCurrent (OPENGL32.@)
*/ */
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc) BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
......
...@@ -382,7 +382,7 @@ ...@@ -382,7 +382,7 @@
@ stdcall wglDescribeLayerPlane(long long long long ptr) @ stdcall wglDescribeLayerPlane(long long long long ptr)
@ stdcall wglDescribePixelFormat(long long long ptr) gdi32.DescribePixelFormat @ stdcall wglDescribePixelFormat(long long long ptr) gdi32.DescribePixelFormat
@ stdcall wglGetCurrentContext() gdi32.wglGetCurrentContext @ stdcall wglGetCurrentContext() gdi32.wglGetCurrentContext
@ stdcall wglGetCurrentDC() @ stdcall wglGetCurrentDC() gdi32.wglGetCurrentDC
@ stub wglGetDefaultProcAddress @ stub wglGetDefaultProcAddress
@ stdcall wglGetLayerPaletteEntries(long long long long ptr) @ stdcall wglGetLayerPaletteEntries(long long long long ptr)
@ stdcall wglGetPixelFormat(long) gdi32.GetPixelFormat @ stdcall wglGetPixelFormat(long) gdi32.GetPixelFormat
......
...@@ -48,7 +48,6 @@ WINE_DECLARE_DEBUG_CHANNEL(opengl); ...@@ -48,7 +48,6 @@ WINE_DECLARE_DEBUG_CHANNEL(opengl);
typedef struct wine_wgl_s { typedef struct wine_wgl_s {
BOOL WINAPI (*p_wglDeleteContext)(HGLRC hglrc); BOOL WINAPI (*p_wglDeleteContext)(HGLRC hglrc);
HDC WINAPI (*p_wglGetCurrentDC)(void);
PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc); PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc);
BOOL WINAPI (*p_wglShareLists)(HGLRC hglrc1, HGLRC hglrc2); BOOL WINAPI (*p_wglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
...@@ -172,14 +171,6 @@ BOOL WINAPI wglDescribeLayerPlane(HDC hdc, ...@@ -172,14 +171,6 @@ BOOL WINAPI wglDescribeLayerPlane(HDC hdc,
} }
/*********************************************************************** /***********************************************************************
* wglGetCurrentDC (OPENGL32.@)
*/
HDC WINAPI wglGetCurrentDC(void) {
TRACE("\n");
return wine_wgl.p_wglGetCurrentDC();
}
/***********************************************************************
* wglGetLayerPaletteEntries (OPENGL32.@) * wglGetLayerPaletteEntries (OPENGL32.@)
*/ */
int WINAPI wglGetLayerPaletteEntries(HDC hdc, int WINAPI wglGetLayerPaletteEntries(HDC hdc,
...@@ -641,7 +632,6 @@ static BOOL process_attach(void) ...@@ -641,7 +632,6 @@ static BOOL process_attach(void)
/* Load WGL function pointers from winex11.drv */ /* Load WGL function pointers from winex11.drv */
wine_wgl.p_wglDeleteContext = (void *)GetProcAddress(mod, "wglDeleteContext"); 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_wglGetProcAddress = (void *)GetProcAddress(mod, "wglGetProcAddress");
wine_wgl.p_wglShareLists = (void *)GetProcAddress(mod, "wglShareLists"); wine_wgl.p_wglShareLists = (void *)GetProcAddress(mod, "wglShareLists");
......
...@@ -1272,27 +1272,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc) ...@@ -1272,27 +1272,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc)
return ret; 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 */ /* OpenGL32 wglGetCurrentReadDCARB */
static HDC WINAPI X11DRV_wglGetCurrentReadDCARB(void) static HDC WINAPI X11DRV_wglGetCurrentReadDCARB(void)
{ {
...@@ -2353,7 +2332,7 @@ static GLboolean WINAPI X11DRV_wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuf ...@@ -2353,7 +2332,7 @@ static GLboolean WINAPI X11DRV_wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuf
object->render_ctx = wglCreateContext(object->render_hdc); object->render_ctx = wglCreateContext(object->render_hdc);
do_init = 1; do_init = 1;
} }
object->prev_hdc = X11DRV_wglGetCurrentDC(); object->prev_hdc = wglGetCurrentDC();
object->prev_ctx = wglGetCurrentContext(); object->prev_ctx = wglGetCurrentContext();
/* FIXME: This is routed through gdi32.dll to winex11.drv, replace this with GLX calls */ /* FIXME: This is routed through gdi32.dll to winex11.drv, replace this with GLX calls */
wglMakeCurrent(object->render_hdc, object->render_ctx); wglMakeCurrent(object->render_hdc, object->render_ctx);
...@@ -2784,12 +2763,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc) { ...@@ -2784,12 +2763,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc) {
return FALSE; return FALSE;
} }
/* OpenGL32 wglGetCurrentDC */
HDC WINAPI X11DRV_wglGetCurrentDC(void) {
ERR_(opengl)("No OpenGL support compiled in.\n");
return 0;
}
/* OpenGL32: wglGetProcAddress */ /* OpenGL32: wglGetProcAddress */
PROC X11DRV_wglGetProcAddress(LPCSTR lpszProc) { PROC X11DRV_wglGetProcAddress(LPCSTR lpszProc) {
ERR_(opengl)("No OpenGL support compiled in.\n"); ERR_(opengl)("No OpenGL support compiled in.\n");
......
...@@ -131,7 +131,6 @@ ...@@ -131,7 +131,6 @@
# OpenGL # OpenGL
@ cdecl wglCreateContext(long) X11DRV_wglCreateContext @ cdecl wglCreateContext(long) X11DRV_wglCreateContext
@ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext @ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext
@ cdecl wglGetCurrentDC() X11DRV_wglGetCurrentDC
@ cdecl wglGetIntegerv(long ptr) X11DRV_wglGetIntegerv @ cdecl wglGetIntegerv(long ptr) X11DRV_wglGetIntegerv
@ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress @ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress
@ cdecl wglMakeCurrent(long long) X11DRV_wglMakeCurrent @ cdecl wglMakeCurrent(long long) X11DRV_wglMakeCurrent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment