diff options
author | Adam Jackson <ajax@redhat.com> | 2020-09-24 17:08:27 -0400 |
---|---|---|
committer | Adam Jackson <ajax@nwnk.net> | 2020-09-28 17:16:24 +0000 |
commit | 96d19e898acb56d8fc6e6febbc6498f67cdd66a0 (patch) | |
tree | fa20829976662ea8fac8c6c8b9ca2ba8ca099b1a /glx | |
parent | c15dd0ba4893f79f7181e783cb1ba404edca917a (diff) |
glx: Implement GLX_EXT_get_drawable_type
Trivial extension to let the client query whether this is a window
pixmap or pbuffer. Mostly for Mesa's convenience when setting up
drawable state, but plausibly useful for apps and middleware as well.
Upstream OpenGL Registry merge request:
https://github.com/KhronosGroup/OpenGL-Registry/pull/425
Diffstat (limited to 'glx')
-rw-r--r-- | glx/extension_string.c | 1 | ||||
-rw-r--r-- | glx/extension_string.h | 1 | ||||
-rw-r--r-- | glx/glxcmds.c | 10 |
3 files changed, 11 insertions, 1 deletions
diff --git a/glx/extension_string.c b/glx/extension_string.c index d7e2c7242..a5b8c747e 100644 --- a/glx/extension_string.c +++ b/glx/extension_string.c @@ -86,6 +86,7 @@ static const struct extension_info known_glx_extensions[] = { { GLX(EXT_create_context_es2_profile), VER(0,0), N, }, { GLX(EXT_fbconfig_packed_float), VER(0,0), N, }, { GLX(EXT_framebuffer_sRGB), VER(0,0), N, }, + { GLX(EXT_get_drawable_type), VER(0,0), Y, }, { GLX(EXT_import_context), VER(0,0), N, }, { GLX(EXT_libglvnd), VER(0,0), N, }, { GLX(EXT_no_config_context), VER(0,0), N, }, diff --git a/glx/extension_string.h b/glx/extension_string.h index eab385a3c..5c8f981d9 100644 --- a/glx/extension_string.h +++ b/glx/extension_string.h @@ -47,6 +47,7 @@ enum { EXT_create_context_es_profile_bit, EXT_create_context_es2_profile_bit, EXT_fbconfig_packed_float_bit, + EXT_get_drawable_type_bit, EXT_import_context_bit, EXT_libglvnd_bit, EXT_no_config_context_bit, diff --git a/glx/glxcmds.c b/glx/glxcmds.c index c29b62676..98ddc7e5e 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -1860,7 +1860,7 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId) xGLXGetDrawableAttributesReply reply; __GLXdrawable *pGlxDraw = NULL; DrawablePtr pDraw; - CARD32 attributes[18]; + CARD32 attributes[20]; int num = 0, error; if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY, @@ -1897,6 +1897,14 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId) ATTRIB(GLX_STEREO_TREE_EXT, 0); } } + + /* GLX_EXT_get_drawable_type */ + if (!pGlxDraw || pGlxDraw->type == GLX_DRAWABLE_WINDOW) + ATTRIB(GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT); + else if (pGlxDraw->type == GLX_DRAWABLE_PIXMAP) + ATTRIB(GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT); + else if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) + ATTRIB(GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT); #undef ATTRIB reply = (xGLXGetDrawableAttributesReply) { |