mirror of
https://github.com/glfw/glfw.git
synced 2025-10-05 06:06:36 +00:00
Cleanup wndconfig usage.
After merging with glfw:transparent, it seems transparent flags are passed around on both fbconfig and wndconfig. This has caused the need to change method signature of a few internal apis. This commit safely removes that redundancy.
This commit is contained in:
parent
0f98e188d2
commit
b8157fea5d
@ -1085,7 +1085,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||||||
if (wndconfig->ns.retina)
|
if (wndconfig->ns.retina)
|
||||||
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
||||||
|
|
||||||
if (wndconfig->transparent)
|
if (_glfw.hints.framebuffer->transparent)
|
||||||
{
|
{
|
||||||
[window->ns.object setOpaque:NO];
|
[window->ns.object setOpaque:NO];
|
||||||
[window->ns.object setBackgroundColor:[NSColor clearColor]];
|
[window->ns.object setBackgroundColor:[NSColor clearColor]];
|
||||||
|
@ -726,8 +726,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
// Returns the Visual and depth of the chosen EGLConfig
|
// Returns the Visual and depth of the chosen EGLConfig
|
||||||
//
|
//
|
||||||
#if defined(_GLFW_X11)
|
#if defined(_GLFW_X11)
|
||||||
GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
|
GLFWbool _glfwChooseVisualEGL(const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWctxconfig* ctxconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig,
|
const _GLFWfbconfig* fbconfig,
|
||||||
Visual** visual, int* depth)
|
Visual** visual, int* depth)
|
||||||
{
|
{
|
||||||
@ -738,7 +737,7 @@ GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
|
|||||||
const long vimask = VisualScreenMask | VisualIDMask;
|
const long vimask = VisualScreenMask | VisualIDMask;
|
||||||
|
|
||||||
|
|
||||||
if (!chooseEGLConfig(ctxconfig, fbconfig, &native, wndconfig->transparent))
|
if (!chooseEGLConfig(ctxconfig, fbconfig, &native, fbconfig->transparent))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
"EGL: Failed to find a suitable EGLConfig");
|
"EGL: Failed to find a suitable EGLConfig");
|
||||||
|
@ -211,8 +211,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
const _GLFWctxconfig* ctxconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig);
|
const _GLFWfbconfig* fbconfig);
|
||||||
#if defined(_GLFW_X11)
|
#if defined(_GLFW_X11)
|
||||||
GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
|
GLFWbool _glfwChooseVisualEGL(const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWctxconfig* ctxconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig,
|
const _GLFWfbconfig* fbconfig,
|
||||||
Visual** visual, int* depth);
|
Visual** visual, int* depth);
|
||||||
#endif /*_GLFW_X11*/
|
#endif /*_GLFW_X11*/
|
||||||
|
@ -283,7 +283,7 @@ static void destroyContextGLX(_GLFWwindow* window)
|
|||||||
GLFWbool _glfwInitGLX(void)
|
GLFWbool _glfwInitGLX(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char* sonames_glx[] =
|
const char* sonames[] =
|
||||||
{
|
{
|
||||||
#if defined(_GLFW_GLX_LIBRARY)
|
#if defined(_GLFW_GLX_LIBRARY)
|
||||||
_GLFW_GLX_LIBRARY,
|
_GLFW_GLX_LIBRARY,
|
||||||
@ -299,9 +299,9 @@ GLFWbool _glfwInitGLX(void)
|
|||||||
if (_glfw.glx.handle)
|
if (_glfw.glx.handle)
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
|
|
||||||
for (i = 0; sonames_glx[i]; i++)
|
for (i = 0; sonames[i]; i++)
|
||||||
{
|
{
|
||||||
_glfw.glx.handle = dlopen(sonames_glx[i], RTLD_LAZY | RTLD_GLOBAL);
|
_glfw.glx.handle = dlopen(sonames[i], RTLD_LAZY | RTLD_GLOBAL);
|
||||||
if (_glfw.glx.handle)
|
if (_glfw.glx.handle)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -664,15 +664,14 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
|
|||||||
|
|
||||||
// Returns the Visual and depth of the chosen GLXFBConfig
|
// Returns the Visual and depth of the chosen GLXFBConfig
|
||||||
//
|
//
|
||||||
GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
|
GLFWbool _glfwChooseVisualGLX(const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWctxconfig* ctxconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig,
|
const _GLFWfbconfig* fbconfig,
|
||||||
Visual** visual, int* depth)
|
Visual** visual, int* depth)
|
||||||
{
|
{
|
||||||
GLXFBConfig native;
|
GLXFBConfig native;
|
||||||
XVisualInfo* result;
|
XVisualInfo* result;
|
||||||
|
|
||||||
if (!chooseGLXFBConfig(fbconfig, &native, wndconfig->transparent))
|
if (!chooseGLXFBConfig(fbconfig, &native, fbconfig->transparent))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
"GLX: Failed to find a suitable GLXFBConfig");
|
"GLX: Failed to find a suitable GLXFBConfig");
|
||||||
@ -688,7 +687,7 @@ GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*visual = result->visual;
|
*visual = result->visual;
|
||||||
*depth = result->depth;
|
*depth = result->depth;
|
||||||
|
|
||||||
XFree(result);
|
XFree(result);
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
|
@ -174,8 +174,7 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
|
|||||||
const _GLFWctxconfig* ctxconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig);
|
const _GLFWfbconfig* fbconfig);
|
||||||
void _glfwDestroyContextGLX(_GLFWwindow* window);
|
void _glfwDestroyContextGLX(_GLFWwindow* window);
|
||||||
GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
|
GLFWbool _glfwChooseVisualGLX(const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWctxconfig* ctxconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig,
|
const _GLFWfbconfig* fbconfig,
|
||||||
Visual** visual, int* depth);
|
Visual** visual, int* depth);
|
||||||
|
|
||||||
|
@ -299,7 +299,6 @@ struct _GLFWwndconfig
|
|||||||
GLFWbool resizable;
|
GLFWbool resizable;
|
||||||
GLFWbool visible;
|
GLFWbool visible;
|
||||||
GLFWbool decorated;
|
GLFWbool decorated;
|
||||||
GLFWbool transparent;
|
|
||||||
GLFWbool focused;
|
GLFWbool focused;
|
||||||
GLFWbool autoIconify;
|
GLFWbool autoIconify;
|
||||||
GLFWbool floating;
|
GLFWbool floating;
|
||||||
|
@ -85,7 +85,7 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
_GLFWfbconfig* u = usableConfigs + usableCount;
|
_GLFWfbconfig* u = usableConfigs + usableCount;
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
|
|
||||||
if (window->transparent) {
|
if (fbconfig->transparent) {
|
||||||
if (!DescribePixelFormat(window->context.wgl.dc,
|
if (!DescribePixelFormat(window->context.wgl.dc,
|
||||||
n,
|
n,
|
||||||
sizeof(PIXELFORMATDESCRIPTOR),
|
sizeof(PIXELFORMATDESCRIPTOR),
|
||||||
@ -168,7 +168,7 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
// Get pixel format attributes through legacy PFDs
|
// Get pixel format attributes through legacy PFDs
|
||||||
|
|
||||||
if (!window->transparent && !DescribePixelFormat(window->context.wgl.dc,
|
if (!fbconfig->transparent && !DescribePixelFormat(window->context.wgl.dc,
|
||||||
n,
|
n,
|
||||||
sizeof(PIXELFORMATDESCRIPTOR),
|
sizeof(PIXELFORMATDESCRIPTOR),
|
||||||
&pfd))
|
&pfd))
|
||||||
@ -221,8 +221,8 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
// Reiterate the selection loop without looking for transparency supporting
|
// Reiterate the selection loop without looking for transparency supporting
|
||||||
// formats if no matching pixelformat for a transparent window were found.
|
// formats if no matching pixelformat for a transparent window were found.
|
||||||
if (window->transparent && !usableCount) {
|
if (fbconfig->transparent && !usableCount) {
|
||||||
window->transparent = GLFW_FALSE;
|
fbconfig->transparent = GLFW_FALSE;
|
||||||
free(usableConfigs);
|
free(usableConfigs);
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"WGL: No pixel format found for transparent window. Ignoring transparency.");
|
"WGL: No pixel format found for transparent window. Ignoring transparency.");
|
||||||
@ -834,10 +834,10 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->transparent)
|
if (fbconfig->transparent)
|
||||||
{
|
{
|
||||||
if (!setupTransparentWindow(window))
|
if (!setupTransparentWindow(window))
|
||||||
window->transparent = GLFW_FALSE;
|
fbconfig->transparent = GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->context.makeCurrent = makeContextCurrentWGL;
|
window->context.makeCurrent = makeContextCurrentWGL;
|
||||||
|
@ -153,7 +153,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
wndconfig.height = height;
|
wndconfig.height = height;
|
||||||
wndconfig.title = title;
|
wndconfig.title = title;
|
||||||
ctxconfig.share = (_GLFWwindow*) share;
|
ctxconfig.share = (_GLFWwindow*) share;
|
||||||
wndconfig.transparent = _glfw.hints.framebuffer.transparent ? GLFW_TRUE : GLFW_FALSE;
|
|
||||||
|
|
||||||
if (ctxconfig.share)
|
if (ctxconfig.share)
|
||||||
{
|
{
|
||||||
@ -182,7 +181,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
window->monitor = (_GLFWmonitor*) monitor;
|
window->monitor = (_GLFWmonitor*) monitor;
|
||||||
window->resizable = wndconfig.resizable;
|
window->resizable = wndconfig.resizable;
|
||||||
window->decorated = wndconfig.decorated;
|
window->decorated = wndconfig.decorated;
|
||||||
window->transparent = wndconfig.transparent;
|
|
||||||
window->autoIconify = wndconfig.autoIconify;
|
window->autoIconify = wndconfig.autoIconify;
|
||||||
window->floating = wndconfig.floating;
|
window->floating = wndconfig.floating;
|
||||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||||
@ -252,7 +250,6 @@ void glfwDefaultWindowHints(void)
|
|||||||
_glfw.hints.window.resizable = GLFW_TRUE;
|
_glfw.hints.window.resizable = GLFW_TRUE;
|
||||||
_glfw.hints.window.visible = GLFW_TRUE;
|
_glfw.hints.window.visible = GLFW_TRUE;
|
||||||
_glfw.hints.window.decorated = GLFW_TRUE;
|
_glfw.hints.window.decorated = GLFW_TRUE;
|
||||||
_glfw.hints.window.transparent = GLFW_FALSE;
|
|
||||||
_glfw.hints.window.focused = GLFW_TRUE;
|
_glfw.hints.window.focused = GLFW_TRUE;
|
||||||
_glfw.hints.window.autoIconify = GLFW_TRUE;
|
_glfw.hints.window.autoIconify = GLFW_TRUE;
|
||||||
|
|
||||||
|
@ -1808,14 +1808,14 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!_glfwInitGLX())
|
if (!_glfwInitGLX())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
if (!_glfwChooseVisualGLX(wndconfig, ctxconfig, fbconfig, &visual, &depth))
|
if (!_glfwChooseVisualGLX(ctxconfig, fbconfig, &visual, &depth))
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
else if (ctxconfig->source == GLFW_EGL_CONTEXT_API)
|
else if (ctxconfig->source == GLFW_EGL_CONTEXT_API)
|
||||||
{
|
{
|
||||||
if (!_glfwInitEGL())
|
if (!_glfwInitEGL())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
if (!_glfwChooseVisualEGL(wndconfig, ctxconfig, fbconfig, &visual, &depth))
|
if (!_glfwChooseVisualEGL(ctxconfig, fbconfig, &visual, &depth))
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
|
else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
|
||||||
|
Loading…
Reference in New Issue
Block a user