free(configs);
}
+static struct glx_config *
+driInferDrawableConfig(struct glx_screen *psc, GLXDrawable draw)
+{
+ unsigned int fbconfig = 0;
+
+ if (__glXGetDrawableAttribute(psc->dpy, draw, GLX_FBCONFIG_ID, &fbconfig)) {
+ return glx_config_find_fbconfig(psc->configs, fbconfig);
+ }
+
+ return NULL;
+}
+
_X_HIDDEN __GLXDRIdrawable *
driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
{
struct glx_display *const priv = __glXInitialize(gc->psc->dpy);
__GLXDRIdrawable *pdraw;
struct glx_screen *psc;
+ struct glx_config *config = gc->config;
if (priv == NULL)
return NULL;
return pdraw;
}
- pdraw = psc->driScreen->createDrawable(psc, glxDrawable,
- glxDrawable, gc->config);
+ if (config == NULL)
+ config = driInferDrawableConfig(gc->psc, glxDrawable);
+ if (config == NULL)
+ return NULL;
+
+ pdraw = psc->driScreen->createDrawable(psc, glxDrawable, glxDrawable,
+ config);
if (pdraw == NULL) {
ErrorMessageF("failed to create drawable\n");
* 10. Given that, this routine should try to use an array on the stack to
* capture the reply rather than always calling Xmalloc.
*/
-static int
-GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
- int attribute, unsigned int *value)
+int
+__glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
+ int attribute, unsigned int *value)
{
struct glx_display *priv;
xGLXGetDrawableAttributesReply reply;
}
}
#else
- GetDrawableAttribute(dpy, drawable, attribute, value);
+ __glXGetDrawableAttribute(dpy, drawable, attribute, value);
#endif
}
glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
int attribute, unsigned int *value)
{
- return GetDrawableAttribute(dpy, drawable, attribute, value);
+ return __glXGetDrawableAttribute(dpy, drawable, attribute, value);
}
#endif
* we could just type-cast the pointer, but why?
*/
- GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
+ __glXGetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
*mask = value;
#endif
}