Add an x11drv escape that returns a glx drawable.

This commit is contained in:
Huw Davies 2005-09-26 11:04:12 +00:00 committed by Alexandre Julliard
parent 2c32428bfe
commit fd7019579a
4 changed files with 60 additions and 0 deletions

View File

@ -416,6 +416,7 @@ BOOL X11DRV_DeleteBitmap( HBITMAP hbitmap )
if (GetObjectW( hbitmap, sizeof(dib), &dib ) == sizeof(dib))
X11DRV_DIB_DeleteDIBSection( physBitmap, &dib );
if (physBitmap->glxpixmap) destroy_glxpixmap(physBitmap->glxpixmap);
wine_tsx11_lock();
if (physBitmap->pixmap) XFreePixmap( gdi_display, physBitmap->pixmap );
XDeleteContext( gdi_display, (XID)hbitmap, bitmap_context );

View File

@ -407,6 +407,21 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
return TRUE;
}
break;
case X11DRV_GET_GLX_DRAWABLE:
if (out_count >= sizeof(Drawable))
{
if(physDev->bitmap)
{
if(!physDev->bitmap->glxpixmap)
physDev->bitmap->glxpixmap = create_glxpixmap(physDev);
*(Drawable *)out_data = physDev->bitmap->glxpixmap;
}
else
*(Drawable *)out_data = physDev->drawable;
return TRUE;
}
break;
}
}
break;

View File

@ -122,6 +122,8 @@ MAKE_FUNCPTR(glXQueryExtension)
MAKE_FUNCPTR(glXGetFBConfigs)
MAKE_FUNCPTR(glXChooseFBConfig)
MAKE_FUNCPTR(glXGetFBConfigAttrib)
MAKE_FUNCPTR(glXCreateGLXPixmap)
MAKE_FUNCPTR(glXDestroyGLXPixmap)
#undef MAKE_FUNCPTR
static BOOL has_opengl(void)
@ -147,6 +149,8 @@ LOAD_FUNCPTR(glXQueryExtension)
LOAD_FUNCPTR(glXGetFBConfigs)
LOAD_FUNCPTR(glXChooseFBConfig)
LOAD_FUNCPTR(glXGetFBConfigAttrib)
LOAD_FUNCPTR(glXCreateGLXPixmap)
LOAD_FUNCPTR(glXDestroyGLXPixmap)
#undef LOAD_FUNCPTR
wine_tsx11_lock();
@ -499,6 +503,32 @@ XVisualInfo *X11DRV_setup_opengl_visual( Display *display )
return visual;
}
XID create_glxpixmap(X11DRV_PDEVICE *physDev)
{
GLXPixmap ret;
XVisualInfo *vis;
XVisualInfo template;
int num;
wine_tsx11_lock();
template.visualid = XVisualIDFromVisual(visual);
vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num);
ret = pglXCreateGLXPixmap(gdi_display, vis, physDev->bitmap->pixmap);
XFree(vis);
wine_tsx11_unlock();
TRACE("return %lx\n", ret);
return ret;
}
BOOL destroy_glxpixmap(XID glxpixmap)
{
wine_tsx11_lock();
pglXDestroyGLXPixmap(gdi_display, glxpixmap);
wine_tsx11_unlock();
return TRUE;
}
#else /* no OpenGL includes */
void X11DRV_OpenGL_Init(Display *display)
@ -561,4 +591,14 @@ XVisualInfo *X11DRV_setup_opengl_visual( Display *display )
return NULL;
}
XID create_glxpixmap(X11DRV_PDEVICE *physDev)
{
return NULL;
}
BOOL destroy_glxpixmap(XID glxpixmap)
{
return FALSE;
}
#endif /* defined(HAVE_OPENGL) */

View File

@ -99,6 +99,7 @@ typedef struct
{
HBITMAP hbitmap;
Pixmap pixmap;
XID glxpixmap;
int pixmap_depth;
/* the following fields are only used for DIB section bitmaps */
int status, p_status; /* mapping status */
@ -274,6 +275,8 @@ extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UIN
extern void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev);
extern XVisualInfo *X11DRV_setup_opengl_visual(Display *display);
extern XID create_glxpixmap(X11DRV_PDEVICE *physDev);
extern BOOL destroy_glxpixmap(XID glxpixmap);
/* XIM support */
extern XIC X11DRV_CreateIC(XIM xim, Display *display, Window win);
@ -479,6 +482,7 @@ enum x11drv_escape_codes
X11DRV_END_EXPOSURES, /* end graphics exposures */
X11DRV_GET_DCE, /* get the DCE pointer */
X11DRV_SET_DCE, /* set the DCE pointer */
X11DRV_GET_GLX_DRAWABLE /* get current glx drawable for a DC */
};
struct x11drv_escape_set_drawable