diff options
-rw-r--r-- | glx/glxcmds.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 6eb3541d0..d8a144fee 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -1945,33 +1945,26 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId) if (pGlxDraw) pDraw = pGlxDraw->pDraw; - attributes[2*num] = GLX_Y_INVERTED_EXT; - attributes[2*num+1] = GL_FALSE; - num++; - attributes[2*num] = GLX_WIDTH; - attributes[2*num+1] = pDraw->width; - num++; - attributes[2*num] = GLX_HEIGHT; - attributes[2*num+1] = pDraw->height; - num++; +#define ATTRIB(a, v) do { \ + attributes[2*num] = (a); \ + attributes[2*num+1] = (v); \ + num++; \ + } while (0) + + ATTRIB(GLX_Y_INVERTED_EXT, GL_FALSE); + ATTRIB(GLX_WIDTH, pDraw->width); + ATTRIB(GLX_HEIGHT, pDraw->height); 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++; + ATTRIB(GLX_TEXTURE_TARGET_EXT, + pGlxDraw->target == GL_TEXTURE_2D ? + GLX_TEXTURE_2D_EXT : GLX_TEXTURE_RECTANGLE_EXT); + ATTRIB(GLX_EVENT_MASK, pGlxDraw->eventMask); + ATTRIB(GLX_FBCONFIG_ID, pGlxDraw->config->fbconfigID); if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) { - attributes[2*num] = GLX_PRESERVED_CONTENTS; - attributes[2*num+1] = GL_TRUE; - num++; + ATTRIB(GLX_PRESERVED_CONTENTS, GL_TRUE); } } +#undef ATTRIB reply = (xGLXGetDrawableAttributesReply) { .type = X_Reply, |