aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail/x11_gl.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-10-03 19:38:53 +0200
committerDavid Robillard <d@drobilla.net>2020-10-04 12:51:32 +0200
commitcc5c38b1aaf93157f5558df95383491a6163cc5a (patch)
treea1b858c00ad84a0479b98247f84e608ac0d62866 /pugl/detail/x11_gl.c
parent6ca124d3787a901129252a2e26c091da1c1ff455 (diff)
downloadpugl-cc5c38b1aaf93157f5558df95383491a6163cc5a.tar.gz
pugl-cc5c38b1aaf93157f5558df95383491a6163cc5a.tar.bz2
pugl-cc5c38b1aaf93157f5558df95383491a6163cc5a.zip
Add puglGetViewHint()
This allows retrieving properties of the view that may be needed, such as the actual bit depth (which may vary from the suggested depth provided as a hint).
Diffstat (limited to 'pugl/detail/x11_gl.c')
-rw-r--r--pugl/detail/x11_gl.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/pugl/detail/x11_gl.c b/pugl/detail/x11_gl.c
index e4a0ea8..228a530 100644
--- a/pugl/detail/x11_gl.c
+++ b/pugl/detail/x11_gl.c
@@ -71,7 +71,7 @@ puglX11GlConfigure(PuglView* view)
GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
- GLX_SAMPLES, view->hints[PUGL_SAMPLES],
+ GLX_SAMPLES, puglX11GlHintValue(view->hints[PUGL_SAMPLES]),
GLX_RED_SIZE, puglX11GlHintValue(view->hints[PUGL_RED_BITS]),
GLX_GREEN_SIZE, puglX11GlHintValue(view->hints[PUGL_GREEN_BITS]),
GLX_BLUE_SIZE, puglX11GlHintValue(view->hints[PUGL_BLUE_BITS]),
@@ -91,6 +91,23 @@ puglX11GlConfigure(PuglView* view)
surface->fb_config = fbc[0];
impl->vi = glXGetVisualFromFBConfig(impl->display, fbc[0]);
+ view->hints[PUGL_RED_BITS] = puglX11GlGetAttrib(
+ display, fbc[0], GLX_RED_SIZE);
+ view->hints[PUGL_GREEN_BITS] = puglX11GlGetAttrib(
+ display, fbc[0], GLX_GREEN_SIZE);
+ view->hints[PUGL_BLUE_BITS] = puglX11GlGetAttrib(
+ display, fbc[0], GLX_BLUE_SIZE);
+ view->hints[PUGL_ALPHA_BITS] = puglX11GlGetAttrib(
+ display, fbc[0], GLX_ALPHA_SIZE);
+ view->hints[PUGL_DEPTH_BITS] = puglX11GlGetAttrib(
+ display, fbc[0], GLX_DEPTH_SIZE);
+ view->hints[PUGL_STENCIL_BITS] = puglX11GlGetAttrib(
+ display, fbc[0], GLX_STENCIL_SIZE);
+ view->hints[PUGL_SAMPLES] = puglX11GlGetAttrib(
+ display, fbc[0], GLX_SAMPLES);
+ view->hints[PUGL_DOUBLE_BUFFER] = puglX11GlGetAttrib(
+ display, fbc[0], GLX_DOUBLEBUFFER);
+
char msg[128];
snprintf(
@@ -182,6 +199,11 @@ puglX11GlCreate(PuglView* view)
GLX_DOUBLEBUFFER,
&view->hints[PUGL_DOUBLE_BUFFER]);
+ glXQueryDrawable(display,
+ impl->win,
+ GLX_SWAP_INTERVAL_EXT,
+ (unsigned int*)&view->hints[PUGL_SWAP_INTERVAL]);
+
return PUGL_SUCCESS;
}