summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2014-12-02 14:52:35 -0500
committerAdam Jackson <ajax@redhat.com>2014-12-10 11:01:43 -0500
commitcadd70c809232c9a6601fb8baab665a7ab10045d (patch)
tree13ede40379474bc9c61ae428f12bbaad3180f863 /glx
parentf452b4a47b3bebf883e84df804e8d54830ccfe83 (diff)
glx: Add hack for GLX-1.2-style naked windows to GetDrawableAttributes
Some people like to call this on bare Window XIDs and expect reasonable results. I sure wish they wouldn't, but since they do, if we're given a window without any glx decoration just fill in as much as we can. This means you won't actually get an answer for GLX_FBCONFIG_ID and friends, but there's not much to be done about that, and it matches what NVIDIA's driver seems to do. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54080 Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/glxcmds.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 4de86439e..f5f2babb8 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1916,38 +1916,48 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
{
ClientPtr client = cl->client;
xGLXGetDrawableAttributesReply reply;
- __GLXdrawable *pGlxDraw;
+ __GLXdrawable *pGlxDraw = NULL;
+ DrawablePtr pDraw;
CARD32 attributes[14];
int num = 0, error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
- DixGetAttrAccess, &pGlxDraw, &error))
- return error;
+ DixGetAttrAccess, &pGlxDraw, &error)) {
+ /* hack for GLX 1.2 naked windows */
+ int err = dixLookupWindow((WindowPtr *)&pDraw, drawId, client,
+ DixGetAttrAccess);
+ if (err != Success)
+ return error;
+ }
+ if (pGlxDraw)
+ pDraw = pGlxDraw->pDraw;
- attributes[2*num] = GLX_TEXTURE_TARGET_EXT;
- attributes[2*num+1] = pGlxDraw->target == GL_TEXTURE_2D ?
- GLX_TEXTURE_2D_EXT :
- GLX_TEXTURE_RECTANGLE_EXT;
- num++;
attributes[2*num] = GLX_Y_INVERTED_EXT;
attributes[2*num+1] = GL_FALSE;
num++;
- attributes[2*num] = GLX_EVENT_MASK;
- attributes[2*num+1] = pGlxDraw->eventMask;
- num++;
attributes[2*num] = GLX_WIDTH;
- attributes[2*num+1] = pGlxDraw->pDraw->width;
+ attributes[2*num+1] = pDraw->width;
num++;
attributes[2*num] = GLX_HEIGHT;
- attributes[2*num+1] = pGlxDraw->pDraw->height;
- num++;
- attributes[2*num] = GLX_FBCONFIG_ID;
- attributes[2*num+1] = pGlxDraw->config->fbconfigID;
+ attributes[2*num+1] = pDraw->height;
num++;
- if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) {
- attributes[2*num] = GLX_PRESERVED_CONTENTS;
- attributes[2*num+1] = GL_TRUE;
+ if (pGlxDraw) {
+ attributes[2*num] = GLX_TEXTURE_TARGET_EXT;
+ attributes[2*num+1] = pGlxDraw->target == GL_TEXTURE_2D ?
+ GLX_TEXTURE_2D_EXT :
+ GLX_TEXTURE_RECTANGLE_EXT;
+ num++;
+ attributes[2*num] = GLX_EVENT_MASK;
+ attributes[2*num+1] = pGlxDraw->eventMask;
num++;
+ attributes[2*num] = GLX_FBCONFIG_ID;
+ attributes[2*num+1] = pGlxDraw->config->fbconfigID;
+ num++;
+ if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) {
+ attributes[2*num] = GLX_PRESERVED_CONTENTS;
+ attributes[2*num+1] = GL_TRUE;
+ num++;
+ }
}
reply = (xGLXGetDrawableAttributesReply) {