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
|
- (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,
|
// 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.
|
// just return NO here instead.
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
@ -863,7 +863,7 @@ static GLFWbool createWindow(_GLFWwindow* window,
|
|||||||
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
||||||
#endif /*_GLFW_USE_RETINA*/
|
#endif /*_GLFW_USE_RETINA*/
|
||||||
|
|
||||||
if (wndconfig->alphaMask)
|
if (wndconfig->transparent)
|
||||||
{
|
{
|
||||||
[window->ns.object setOpaque:NO];
|
[window->ns.object setOpaque:NO];
|
||||||
[window->ns.object setBackgroundColor:[NSColor clearColor]];
|
[window->ns.object setBackgroundColor:[NSColor clearColor]];
|
||||||
|
@ -216,7 +216,7 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desired->alphaMask > 0 && current->alphaMask == 0)
|
if (desired->transparent > 0 && current->transparent == 0)
|
||||||
{
|
{
|
||||||
// Alpha mask is a hard constraint
|
// Alpha mask is a hard constraint
|
||||||
continue;
|
continue;
|
||||||
|
@ -185,7 +185,7 @@ struct _GLFWwndconfig
|
|||||||
GLFWbool focused;
|
GLFWbool focused;
|
||||||
GLFWbool autoIconify;
|
GLFWbool autoIconify;
|
||||||
GLFWbool floating;
|
GLFWbool floating;
|
||||||
GLFWbool alphaMask;
|
GLFWbool transparent;
|
||||||
_GLFWmonitor* monitor;
|
_GLFWmonitor* monitor;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ struct _GLFWfbconfig
|
|||||||
int samples;
|
int samples;
|
||||||
GLFWbool sRGB;
|
GLFWbool sRGB;
|
||||||
GLFWbool doublebuffer;
|
GLFWbool doublebuffer;
|
||||||
int alphaMask;
|
int transparent;
|
||||||
|
|
||||||
// This is defined in the context API's context.h
|
// This is defined in the context API's context.h
|
||||||
_GLFW_PLATFORM_FBCONFIG;
|
_GLFW_PLATFORM_FBCONFIG;
|
||||||
|
@ -215,7 +215,7 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fbconfig->alphaMask)
|
if (fbconfig->transparent)
|
||||||
{
|
{
|
||||||
GLint opaque = 0;
|
GLint opaque = 0;
|
||||||
[window->context.nsgl.object setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
|
[window->context.nsgl.object setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
|
||||||
|
@ -236,8 +236,8 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
|
|||||||
u->doublebuffer = GLFW_TRUE;
|
u->doublebuffer = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// always able to create alpha mask on win
|
// always able to create transparent windows on Windows
|
||||||
u->alphaMask = desired->alphaMask;
|
u->transparent = desired->transparent;
|
||||||
|
|
||||||
u->wgl = n;
|
u->wgl = n;
|
||||||
usableCount++;
|
usableCount++;
|
||||||
|
26
src/window.c
26
src/window.c
@ -132,17 +132,17 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fbconfig = _glfw.hints.framebuffer;
|
fbconfig = _glfw.hints.framebuffer;
|
||||||
ctxconfig = _glfw.hints.context;
|
ctxconfig = _glfw.hints.context;
|
||||||
wndconfig = _glfw.hints.window;
|
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.width = width;
|
||||||
wndconfig.height = height;
|
wndconfig.height = height;
|
||||||
wndconfig.title = title;
|
wndconfig.title = title;
|
||||||
wndconfig.monitor = (_GLFWmonitor*) monitor;
|
wndconfig.monitor = (_GLFWmonitor*) monitor;
|
||||||
ctxconfig.share = (_GLFWwindow*) share;
|
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)
|
if (ctxconfig.share)
|
||||||
{
|
{
|
||||||
@ -179,7 +179,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
window->decorated = wndconfig.decorated;
|
window->decorated = wndconfig.decorated;
|
||||||
window->autoIconify = wndconfig.autoIconify;
|
window->autoIconify = wndconfig.autoIconify;
|
||||||
window->floating = wndconfig.floating;
|
window->floating = wndconfig.floating;
|
||||||
window->transparent = wndconfig.alphaMask;
|
window->transparent = wndconfig.transparent;
|
||||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||||
|
|
||||||
// Save the currently current context so it can be restored later
|
// 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.depthBits = 24;
|
||||||
_glfw.hints.framebuffer.stencilBits = 8;
|
_glfw.hints.framebuffer.stencilBits = 8;
|
||||||
_glfw.hints.framebuffer.doublebuffer = GLFW_TRUE;
|
_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
|
// The default is to select the highest available refresh rate
|
||||||
_glfw.hints.refreshRate = GLFW_DONT_CARE;
|
_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;
|
_glfw.hints.framebuffer.doublebuffer = hint ? GLFW_TRUE : GLFW_FALSE;
|
||||||
break;
|
break;
|
||||||
case GLFW_TRANSPARENT:
|
case GLFW_TRANSPARENT:
|
||||||
_glfw.hints.framebuffer.alphaMask = hint;
|
_glfw.hints.framebuffer.transparent = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_SAMPLES:
|
case GLFW_SAMPLES:
|
||||||
_glfw.hints.framebuffer.samples = hint;
|
_glfw.hints.framebuffer.samples = hint;
|
||||||
|
Loading…
Reference in New Issue
Block a user