Roderick Colenbrander : wgl: Move wglGetCurrentContext to gdi32.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Oct 16 05:28:55 CDT 2006
Module: wine
Branch: master
Commit: ad7bc71c0c45f7f627c52695e3b0b8fba74a9020
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ad7bc71c0c45f7f627c52695e3b0b8fba74a9020
Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date: Sat Oct 14 12:56:07 2006 +0200
wgl: Move wglGetCurrentContext to gdi32.
---
dlls/gdi/gdi32.spec | 1 +
dlls/gdi/opengl.c | 12 ++++++++++++
dlls/opengl32/opengl32.spec | 2 +-
dlls/opengl32/wgl.c | 10 ----------
dlls/winex11.drv/opengl.c | 27 +++------------------------
dlls/winex11.drv/winex11.drv.spec | 1 -
6 files changed, 17 insertions(+), 36 deletions(-)
diff --git a/dlls/gdi/gdi32.spec b/dlls/gdi/gdi32.spec
index b1883a7..75b5496 100644
--- a/dlls/gdi/gdi32.spec
+++ b/dlls/gdi/gdi32.spec
@@ -499,6 +499,7 @@ ########################################
# Wine extensions: OpenGL support
#
@ stdcall wglCreateContext(long)
+@ stdcall wglGetCurrentContext()
@ 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 75a8e6d..5203e46 100644
--- a/dlls/gdi/opengl.c
+++ b/dlls/gdi/opengl.c
@@ -31,6 +31,8 @@ #include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
+#include "winternl.h"
+#include "winnt.h"
#include "gdi.h"
#include "gdi_private.h"
#include "wine/debug.h"
@@ -73,6 +75,16 @@ HGLRC WINAPI wglCreateContext(HDC hdc)
}
/***********************************************************************
+ * wglGetCurrentContext (OPENGL32.@)
+ */
+HGLRC WINAPI wglGetCurrentContext(void)
+{
+ HGLRC ret = NtCurrentTeb()->glContext;
+ TRACE(" returning %p\n", ret);
+ return ret;
+}
+
+/***********************************************************************
* wglMakeCurrent (OPENGL32.@)
*/
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
diff --git a/dlls/opengl32/opengl32.spec b/dlls/opengl32/opengl32.spec
index 7fb060c..180beb1 100644
--- a/dlls/opengl32/opengl32.spec
+++ b/dlls/opengl32/opengl32.spec
@@ -381,7 +381,7 @@
@ stdcall wglDeleteContext(long)
@ stdcall wglDescribeLayerPlane(long long long long ptr)
@ stdcall wglDescribePixelFormat(long long long ptr) gdi32.DescribePixelFormat
-@ stdcall wglGetCurrentContext()
+@ stdcall wglGetCurrentContext() gdi32.wglGetCurrentContext
@ stdcall wglGetCurrentDC()
@ stub wglGetDefaultProcAddress
@ stdcall wglGetLayerPaletteEntries(long long long long ptr)
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 1c3973c..52e5a55 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);
- HGLRC WINAPI (*p_wglGetCurrentContext)(void);
HDC WINAPI (*p_wglGetCurrentDC)(void);
PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc);
BOOL WINAPI (*p_wglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
@@ -173,14 +172,6 @@ BOOL WINAPI wglDescribeLayerPlane(HDC hd
}
/***********************************************************************
- * wglGetCurrentContext (OPENGL32.@)
- */
-HGLRC WINAPI wglGetCurrentContext(void) {
- TRACE("\n");
- return wine_wgl.p_wglGetCurrentContext();
-}
-
-/***********************************************************************
* wglGetCurrentDC (OPENGL32.@)
*/
HDC WINAPI wglGetCurrentDC(void) {
@@ -650,7 +641,6 @@ static BOOL process_attach(void)
/* Load WGL function pointers from winex11.drv */
wine_wgl.p_wglDeleteContext = (void *)GetProcAddress(mod, "wglDeleteContext");
- wine_wgl.p_wglGetCurrentContext = (void *)GetProcAddress(mod, "wglGetCurrentContext");
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 490a08e..a81816f 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1272,23 +1272,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLR
return ret;
}
-/* OpenGL32 wglGetCurrentContext() */
-HGLRC WINAPI X11DRV_wglGetCurrentContext(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();
-
- TRACE(" returning %p (GL context %p)\n", ret, gl_ctx);
-
- return (HGLRC)ret;
-}
-
/* OpenGL32 wglGetCurrentDC */
HDC WINAPI X11DRV_wglGetCurrentDC(void) {
GLXContext gl_ctx;
@@ -1417,6 +1400,7 @@ static BOOL WINAPI X11DRV_wglMakeContext
wine_tsx11_lock();
if (hglrc == NULL) {
ret = pglXMakeCurrent(gdi_display, None, NULL);
+ NtCurrentTeb()->glContext = NULL;
} else {
if (NULL == pglXMakeContextCurrent) {
ret = FALSE;
@@ -1430,6 +1414,7 @@ static BOOL WINAPI X11DRV_wglMakeContext
TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx);
}
ret = pglXMakeContextCurrent(ctx->display, d_draw, d_read, ctx->ctx);
+ NtCurrentTeb()->glContext = ctx;
}
}
wine_tsx11_unlock();
@@ -2369,7 +2354,7 @@ static GLboolean WINAPI X11DRV_wglBindTe
do_init = 1;
}
object->prev_hdc = X11DRV_wglGetCurrentDC();
- object->prev_ctx = X11DRV_wglGetCurrentContext();
+ 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);
/*
@@ -2799,12 +2784,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLR
return FALSE;
}
-/* OpenGL32 wglGetCurrentContext() */
-HGLRC WINAPI X11DRV_wglGetCurrentContext(void) {
- ERR_(opengl)("No OpenGL support compiled in.\n");
- return NULL;
-}
-
/* OpenGL32 wglGetCurrentDC */
HDC WINAPI X11DRV_wglGetCurrentDC(void) {
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 4e4dcbf..4cfc0f9 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 wglGetCurrentContext() X11DRV_wglGetCurrentContext
@ cdecl wglGetCurrentDC() X11DRV_wglGetCurrentDC
@ cdecl wglGetIntegerv(long ptr) X11DRV_wglGetIntegerv
@ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress
More information about the wine-cvs
mailing list