mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +00:00
Changed 'alphaMask' to 'transparent' per @elmindreda's request.
This commit is contained in:
parent
69fca03d78
commit
c8c7ad249a
@ -322,9 +322,9 @@ static int translateKey(unsigned int key)
|
||||
|
||||
- (BOOL)isOpaque
|
||||
{
|
||||
// Set to NO even if alphaMask is not used;
|
||||
// Set to NO even if transparent is not used;
|
||||
// The NSView/GLFWContentView does not need to be opaque anyway,
|
||||
// and to avoid keeping track of alphaMask inside the NSView we
|
||||
// and to avoid keeping track of transparent inside the NSView we
|
||||
// just return NO here instead.
|
||||
return NO;
|
||||
}
|
||||
@ -863,7 +863,7 @@ static GLFWbool createWindow(_GLFWwindow* window,
|
||||
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
||||
#endif /*_GLFW_USE_RETINA*/
|
||||
|
||||
if (wndconfig->alphaMask)
|
||||
if (wndconfig->transparent)
|
||||
{
|
||||
[window->ns.object setOpaque:NO];
|
||||
[window->ns.object setBackgroundColor:[NSColor clearColor]];
|
||||
|
@ -216,7 +216,7 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (desired->alphaMask > 0 && current->alphaMask == 0)
|
||||
if (desired->transparent > 0 && current->transparent == 0)
|
||||
{
|
||||
// Alpha mask is a hard constraint
|
||||
continue;
|
||||
|
@ -185,7 +185,7 @@ struct _GLFWwndconfig
|
||||
GLFWbool focused;
|
||||
GLFWbool autoIconify;
|
||||
GLFWbool floating;
|
||||
GLFWbool alphaMask;
|
||||
GLFWbool transparent;
|
||||
_GLFWmonitor* monitor;
|
||||
};
|
||||
|
||||
@ -236,7 +236,7 @@ struct _GLFWfbconfig
|
||||
int samples;
|
||||
GLFWbool sRGB;
|
||||
GLFWbool doublebuffer;
|
||||
int alphaMask;
|
||||
int transparent;
|
||||
|
||||
// This is defined in the context API's context.h
|
||||
_GLFW_PLATFORM_FBCONFIG;
|
||||
|
@ -215,7 +215,7 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (fbconfig->alphaMask)
|
||||
if (fbconfig->transparent)
|
||||
{
|
||||
GLint opaque = 0;
|
||||
[window->context.nsgl.object setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
|
||||
|
@ -236,8 +236,8 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
|
||||
u->doublebuffer = GLFW_TRUE;
|
||||
}
|
||||
|
||||
// always able to create alpha mask on win
|
||||
u->alphaMask = desired->alphaMask;
|
||||
// always able to create transparent windows on Windows
|
||||
u->transparent = desired->transparent;
|
||||
|
||||
u->wgl = n;
|
||||
usableCount++;
|
||||
|
10
src/window.c
10
src/window.c
@ -135,14 +135,14 @@ 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;
|
||||
wndconfig.monitor = (_GLFWmonitor*) monitor;
|
||||
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)
|
||||
{
|
||||
@ -179,7 +179,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
window->decorated = wndconfig.decorated;
|
||||
window->autoIconify = wndconfig.autoIconify;
|
||||
window->floating = wndconfig.floating;
|
||||
window->transparent = wndconfig.alphaMask;
|
||||
window->transparent = wndconfig.transparent;
|
||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||
|
||||
// Save the currently current context so it can be restored later
|
||||
@ -268,7 +268,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;
|
||||
@ -320,7 +320,7 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
||||
_glfw.hints.framebuffer.doublebuffer = hint ? GLFW_TRUE : GLFW_FALSE;
|
||||
break;
|
||||
case GLFW_TRANSPARENT:
|
||||
_glfw.hints.framebuffer.alphaMask = hint;
|
||||
_glfw.hints.framebuffer.transparent = hint;
|
||||
break;
|
||||
case GLFW_SAMPLES:
|
||||
_glfw.hints.framebuffer.samples = hint;
|
||||
|
Loading…
Reference in New Issue
Block a user