Commit 93e66661 authored by Bailey Cosier's avatar Bailey Cosier Committed by Camilla Löwy
Browse files

Cleanup

This is an extract of a commit, minimally edited to ensure it compiles.

Closes #1078.
Related to #197.
parent ac009a5f
......@@ -287,6 +287,10 @@ __GLFW_DOUBLEBUFFER__ specifies whether the framebuffer should be double
buffered. You nearly always want to use double buffering. This is a hard
constraint. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
@anchor GLFW_TRANSPARENT_hint
__GLFW_TRANSPARENT__ specifies whether the framebuffer will support transparency
in the background. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
@subsubsection window_hints_mtr Monitor related hints
......
......@@ -787,7 +787,6 @@ extern "C" {
* Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).
*/
#define GLFW_CENTER_CURSOR 0x00020009
#define GLFW_TRANSPARENT 0x0002000A
/*! @brief Framebuffer bit depth hint.
*
......@@ -869,6 +868,12 @@ extern "C" {
* Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
*/
#define GLFW_DOUBLEBUFFER 0x00021010
/*! @brief Framebuffer transparency hint.
*
* Framebuffer transparency [hint](@ref GLFW_TRANSPARENT_hint).
*/
#define GLFW_TRANSPARENT 0x00021011
/*! @brief Context client API hint and attribute.
*
* Context client API [hint](@ref GLFW_CLIENT_API_hint) and
......
......@@ -1085,7 +1085,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
if (wndconfig->ns.retina)
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
if (window->transparent)
if (_glfw.hints.framebuffer.transparent)
{
[window->ns.object setOpaque:NO];
[window->ns.object setBackgroundColor:[NSColor clearColor]];
......
......@@ -493,7 +493,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
if (ctxconfig->share)
share = ctxconfig->share->context.egl.handle;
if (!chooseEGLConfig(ctxconfig, fbconfig, &config, window->transparent))
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,
EGLint visualID = 0, count = 0;
const long vimask = VisualScreenMask | VisualIDMask;
if (!chooseEGLConfig(ctxconfig, fbconfig, &native, wndconfig->transparent))
if (!chooseEGLConfig(ctxconfig, fbconfig, &native, fbconfig->transparent))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"EGL: Failed to find a suitable EGLConfig");
......
......@@ -477,7 +477,7 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
if (ctxconfig->share)
share = ctxconfig->share->context.glx.handle;
if (!chooseGLXFBConfig(fbconfig, &native, window->transparent))
if (!chooseGLXFBConfig(fbconfig, &native, fbconfig->transparent))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"GLX: Failed to find a suitable GLXFBConfig");
......@@ -665,7 +665,7 @@ GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
GLXFBConfig native;
XVisualInfo* result;
if (!chooseGLXFBConfig(fbconfig, &native, wndconfig->transparent))
if (!chooseGLXFBConfig(fbconfig, &native, fbconfig->transparent))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"GLX: Failed to find a suitable GLXFBConfig");
......
......@@ -299,7 +299,6 @@ struct _GLFWwndconfig
GLFWbool resizable;
GLFWbool visible;
GLFWbool decorated;
GLFWbool transparent;
GLFWbool focused;
GLFWbool autoIconify;
GLFWbool floating;
......@@ -360,6 +359,7 @@ struct _GLFWfbconfig
int samples;
GLFWbool sRGB;
GLFWbool doublebuffer;
GLFWbool transparent;
uintptr_t handle;
};
......@@ -403,7 +403,6 @@ struct _GLFWwindow
// Window settings and state
GLFWbool resizable;
GLFWbool decorated;
GLFWbool transparent;
GLFWbool autoIconify;
GLFWbool floating;
GLFWbool shouldClose;
......
......@@ -296,7 +296,7 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
return GLFW_FALSE;
}
if (window->transparent)
if (fbconfig->transparent)
{
GLint opaque = 0;
[window->context.nsgl.object setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
......
......@@ -85,7 +85,7 @@ static int choosePixelFormat(_GLFWwindow* window,
_GLFWfbconfig* u = usableConfigs + usableCount;
PIXELFORMATDESCRIPTOR pfd;
if (window->transparent) {
if (fbconfig->transparent) {
if (!DescribePixelFormat(window->context.wgl.dc,
n,
sizeof(PIXELFORMATDESCRIPTOR),
......@@ -168,7 +168,7 @@ static int choosePixelFormat(_GLFWwindow* window,
{
// Get pixel format attributes through legacy PFDs
if (!window->transparent && DescribePixelFormat(window->context.wgl.dc,
if (!fbconfig->transparent && DescribePixelFormat(window->context.wgl.dc,
n,
sizeof(PIXELFORMATDESCRIPTOR),
&pfd))
......@@ -217,8 +217,7 @@ static int choosePixelFormat(_GLFWwindow* window,
}
// Reiterate the selection loop without looking for transparency supporting
// formats if no matching pixelformat for a transparent window were found.
if (window->transparent && !usableCount) {
window->transparent = GLFW_FALSE;
if (fbconfig->transparent && !usableCount) {
free(usableConfigs);
_glfwInputError(GLFW_PLATFORM_ERROR,
"WGL: No pixel format found for transparent window. Ignoring transparency.");
......@@ -803,10 +802,12 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
}
}
if (window->transparent)
if (fbconfig->transparent)
{
if (!setupTransparentWindow(window))
window->transparent = GLFW_FALSE;
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"WGL: Failed to setup window as transparent as requested");
}
window->context.makeCurrent = makeContextCurrentWGL;
......
......@@ -147,6 +147,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
fbconfig = _glfw.hints.framebuffer;
ctxconfig = _glfw.hints.context;
wndconfig = _glfw.hints.window;
fbconfig.transparent = _glfw.hints.framebuffer.transparent ? GLFW_TRUE : GLFW_FALSE;
wndconfig.width = width;
wndconfig.height = height;
......@@ -180,7 +181,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
window->monitor = (_GLFWmonitor*) monitor;
window->resizable = wndconfig.resizable;
window->decorated = wndconfig.decorated;
window->transparent = wndconfig.transparent;
window->autoIconify = wndconfig.autoIconify;
window->floating = wndconfig.floating;
window->cursorMode = GLFW_CURSOR_NORMAL;
......@@ -250,7 +250,6 @@ void glfwDefaultWindowHints(void)
_glfw.hints.window.resizable = GLFW_TRUE;
_glfw.hints.window.visible = GLFW_TRUE;
_glfw.hints.window.decorated = GLFW_TRUE;
_glfw.hints.window.transparent = GLFW_FALSE;
_glfw.hints.window.focused = GLFW_TRUE;
_glfw.hints.window.autoIconify = GLFW_TRUE;
......@@ -317,6 +316,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
case GLFW_DOUBLEBUFFER:
_glfw.hints.framebuffer.doublebuffer = value ? GLFW_TRUE : GLFW_FALSE;
return;
case GLFW_TRANSPARENT:
_glfw.hints.framebuffer.transparent = value ? GLFW_TRUE : GLFW_FALSE;
return;
case GLFW_SAMPLES:
_glfw.hints.framebuffer.samples = value;
return;
......@@ -329,9 +331,6 @@ GLFWAPI void glfwWindowHint(int hint, int value)
case GLFW_DECORATED:
_glfw.hints.window.decorated = value ? GLFW_TRUE : GLFW_FALSE;
return;
case GLFW_TRANSPARENT:
_glfw.hints.window.transparent = value ? GLFW_TRUE : GLFW_FALSE;
return;
case GLFW_FOCUSED:
_glfw.hints.window.focused = value ? GLFW_TRUE : GLFW_FALSE;
return;
......@@ -733,8 +732,6 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
return window->resizable;
case GLFW_DECORATED:
return window->decorated;
case GLFW_TRANSPARENT:
return window->transparent;
case GLFW_FLOATING:
return window->floating;
case GLFW_AUTO_ICONIFY:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment