From 3a3a0b301367fa882868c952c181bd2d8f1a7e51 Mon Sep 17 00:00:00 2001 From: Tomas Carnecky Date: Tue, 9 May 2006 00:38:00 +0200 Subject: [PATCH] opengl: Properly use glXQueryDrawable() to get the Visual ID. --- dlls/opengl32/wgl.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index c7d3147c5b6..a9d0b27f586 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -509,22 +509,35 @@ static int describeContext(Wine_GLContext* ctx) { static int describeDrawable(Wine_GLContext* ctx, Drawable drawable) { int tmp; - int draw_vis_id; + int nElements; + int attribList[3] = { GLX_FBCONFIG_ID, 0, None }; + GLXFBConfig *fbCfgs; + if (3 > wine_glx.version || NULL == wine_glx.p_glXQueryDrawable) { /** glXQueryDrawable not available so returns not supported */ return -1; } + TRACE(" Drawable %p have :\n", (void*) drawable); - wine_glx.p_glXQueryDrawable(ctx->display, drawable, GLX_FBCONFIG_ID, (unsigned int*) &tmp); - TRACE(" - FBCONFIG_ID as 0x%x\n", tmp); - wine_glx.p_glXQueryDrawable(ctx->display, drawable, GLX_VISUAL_ID, (unsigned int*) &tmp); - TRACE(" - VISUAL_ID as 0x%x\n", tmp); - draw_vis_id = tmp; wine_glx.p_glXQueryDrawable(ctx->display, drawable, GLX_WIDTH, (unsigned int*) &tmp); TRACE(" - WIDTH as %d\n", tmp); wine_glx.p_glXQueryDrawable(ctx->display, drawable, GLX_HEIGHT, (unsigned int*) &tmp); TRACE(" - HEIGHT as %d\n", tmp); - return draw_vis_id; + wine_glx.p_glXQueryDrawable(ctx->display, drawable, GLX_FBCONFIG_ID, (unsigned int*) &tmp); + TRACE(" - FBCONFIG_ID as 0x%x\n", tmp); + + attribList[1] = tmp; + fbCfgs = wine_glx.p_glXChooseFBConfig(ctx->display, DefaultScreen(ctx->display), attribList, &nElements); + if (fbCfgs == NULL) { + return -1; + } + + wine_glx.p_glXGetFBConfigAttrib(ctx->display, fbCfgs[0], GLX_VISUAL_ID, &tmp); + TRACE(" - VISUAL_ID as 0x%x\n", tmp); + + XFree(fbCfgs); + + return tmp; } /***********************************************************************