mirror of
https://github.com/glfw/glfw.git
synced 2025-10-05 06:06:36 +00:00
Renaming alphaMask flag to 'transparent' for consistency
This commit is contained in:
parent
98563d8d4b
commit
1d44ad152e
@ -182,12 +182,6 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (desired->alphaMask > 0 && current->alphaMask == 0)
|
||||
{
|
||||
// Alpha mask is a hard constraint
|
||||
continue;
|
||||
}
|
||||
|
||||
// Count number of missing buffers
|
||||
{
|
||||
missing = 0;
|
||||
|
@ -492,7 +492,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
||||
if (ctxconfig->share)
|
||||
share = ctxconfig->share->context.egl.handle;
|
||||
|
||||
if (!chooseEGLConfig(ctxconfig, fbconfig, &config, fbconfig->alphaMask))
|
||||
if (!chooseEGLConfig(ctxconfig, fbconfig, &config, fbconfig->transparent))
|
||||
{
|
||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||
"EGL: Failed to find a suitable EGLConfig");
|
||||
@ -738,7 +738,7 @@ GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
|
||||
const long vimask = VisualScreenMask | VisualIDMask;
|
||||
|
||||
|
||||
if (!chooseEGLConfig(ctxconfig, fbconfig, &native, wndconfig->alphaMask))
|
||||
if (!chooseEGLConfig(ctxconfig, fbconfig, &native, wndconfig->transparent))
|
||||
{
|
||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||
"EGL: Failed to find a suitable EGLConfig");
|
||||
|
@ -64,6 +64,8 @@ static GLFWbool chooseGLXFBConfig(
|
||||
findTransparent = GLFW_FALSE;
|
||||
}
|
||||
|
||||
findTransparent = GLFW_TRUE;
|
||||
|
||||
// HACK: This is a (hopefully temporary) workaround for Chromium
|
||||
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
|
||||
vendor = glXGetClientString(_glfw.x11.display, GLX_VENDOR);
|
||||
@ -81,7 +83,7 @@ static GLFWbool chooseGLXFBConfig(
|
||||
|
||||
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||
usableCount = 0;
|
||||
|
||||
|
||||
selectionloop:
|
||||
for (i = 0; i < nativeCount; i++)
|
||||
{
|
||||
@ -99,25 +101,31 @@ selectionloop:
|
||||
continue;
|
||||
}
|
||||
|
||||
if( findTransparent ) {
|
||||
if( findTransparent ) {
|
||||
XVisualInfo *visualinfo;
|
||||
XRenderPictFormat *pictFormat;
|
||||
|
||||
visualinfo = glXGetVisualFromFBConfig(_glfw.x11.display, n);
|
||||
if (!visualinfo)
|
||||
continue;
|
||||
visualinfo = glXGetVisualFromFBConfig(_glfw.x11.display, n);
|
||||
if (!visualinfo) {
|
||||
printf("!visualinfo: bail\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
pictFormat = XRenderFindVisualFormat(_glfw.x11.display, visualinfo->visual);
|
||||
if( !pictFormat ) {
|
||||
XFree( visualinfo );
|
||||
continue;
|
||||
}
|
||||
printf("!pictFormat: bail\n");
|
||||
XFree( visualinfo );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !pictFormat->direct.alphaMask ) {
|
||||
XFree( visualinfo );
|
||||
continue;
|
||||
}
|
||||
XFree( visualinfo );
|
||||
printf("!pictFormat->direct alphaMask: bail\n");
|
||||
XFree( visualinfo );
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("looking for transparent visual: didn't find\n");
|
||||
XFree( visualinfo );
|
||||
}
|
||||
|
||||
u->redBits = getGLXFBConfigAttrib(n, GLX_RED_SIZE);
|
||||
@ -150,7 +158,7 @@ selectionloop:
|
||||
usableCount++;
|
||||
}
|
||||
// reiterate the selection loop without looking for transparency supporting
|
||||
// formats if no matchig FB configs for a transparent window were found.
|
||||
// formats if no matchig FB configs for a transparent window were found.
|
||||
if( findTransparent && !usableCount ) {
|
||||
findTransparent = GLFW_FALSE;
|
||||
goto selectionloop;
|
||||
@ -722,4 +730,3 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
|
||||
|
||||
return window->context.glx.window;
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,6 @@ struct _GLFWwndconfig
|
||||
GLFWbool floating;
|
||||
GLFWbool maximized;
|
||||
GLFWbool centerCursor;
|
||||
GLFWbool alphaMask;
|
||||
struct {
|
||||
GLFWbool retina;
|
||||
GLFWbool frame;
|
||||
@ -349,7 +348,7 @@ struct _GLFWfbconfig
|
||||
int redBits;
|
||||
int greenBits;
|
||||
int blueBits;
|
||||
int alphaMask;
|
||||
int transparent;
|
||||
int alphaBits;
|
||||
int depthBits;
|
||||
int stencilBits;
|
||||
|
@ -213,8 +213,10 @@ static int choosePixelFormat(_GLFWwindow* window,
|
||||
}
|
||||
|
||||
u->handle = n;
|
||||
// always able to create alpha mask on win
|
||||
u->alphaMask = 1;
|
||||
|
||||
// always able to go transparent on win dwmapi
|
||||
u->transparent = 1;
|
||||
|
||||
usableCount++;
|
||||
}
|
||||
// Reiterate the selection loop without looking for transparency supporting
|
||||
|
@ -147,13 +147,13 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
fbconfig = _glfw.hints.framebuffer;
|
||||
ctxconfig = _glfw.hints.context;
|
||||
wndconfig = _glfw.hints.window;
|
||||
fbconfig.alphaMask = _glfw.hints.framebuffer.alphaMask ? GLFW_TRUE : GLFW_FALSE;
|
||||
fbconfig.transparent = _glfw.hints.framebuffer.transparent ? GLFW_TRUE : GLFW_FALSE;
|
||||
|
||||
wndconfig.width = width;
|
||||
wndconfig.height = height;
|
||||
wndconfig.title = title;
|
||||
ctxconfig.share = (_GLFWwindow*) share;
|
||||
wndconfig.alphaMask = _glfw.hints.framebuffer.alphaMask ? GLFW_TRUE : GLFW_FALSE;
|
||||
wndconfig.transparent = _glfw.hints.framebuffer.transparent ? GLFW_TRUE : GLFW_FALSE;
|
||||
|
||||
if (ctxconfig.share)
|
||||
{
|
||||
@ -185,7 +185,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
window->transparent = wndconfig.transparent;
|
||||
window->autoIconify = wndconfig.autoIconify;
|
||||
window->floating = wndconfig.floating;
|
||||
window->transparent = wndconfig.alphaMask;
|
||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||
|
||||
window->minwidth = GLFW_DONT_CARE;
|
||||
@ -267,7 +266,7 @@ void glfwDefaultWindowHints(void)
|
||||
_glfw.hints.framebuffer.depthBits = 24;
|
||||
_glfw.hints.framebuffer.stencilBits = 8;
|
||||
_glfw.hints.framebuffer.doublebuffer = GLFW_TRUE;
|
||||
_glfw.hints.framebuffer.alphaMask = GLFW_FALSE;
|
||||
_glfw.hints.framebuffer.transparent = GLFW_FALSE;
|
||||
|
||||
// The default is to select the highest available refresh rate
|
||||
_glfw.hints.refreshRate = GLFW_DONT_CARE;
|
||||
@ -322,7 +321,7 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
||||
_glfw.hints.framebuffer.doublebuffer = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_TRANSPARENT:
|
||||
_glfw.hints.framebuffer.alphaMask = value;
|
||||
_glfw.hints.framebuffer.transparent = value;
|
||||
return;
|
||||
case GLFW_SAMPLES:
|
||||
_glfw.hints.framebuffer.samples = value;
|
||||
|
Loading…
Reference in New Issue
Block a user