Cleanup.
This commit is contained in:
parent
96b3f17d02
commit
5f74c2afdf
40
src/window.c
40
src/window.c
@ -142,6 +142,13 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
wndconfig.monitor = (_GLFWmonitor*) monitor;
|
wndconfig.monitor = (_GLFWmonitor*) monitor;
|
||||||
ctxconfig.share = (_GLFWwindow*) share;
|
ctxconfig.share = (_GLFWwindow*) share;
|
||||||
|
|
||||||
|
if (wndconfig.monitor)
|
||||||
|
{
|
||||||
|
wndconfig.resizable = GL_TRUE;
|
||||||
|
wndconfig.visible = GL_TRUE;
|
||||||
|
wndconfig.focused = GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// Check the OpenGL bits of the window config
|
// Check the OpenGL bits of the window config
|
||||||
if (!_glfwIsValidContextConfig(&ctxconfig))
|
if (!_glfwIsValidContextConfig(&ctxconfig))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -157,15 +164,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
window->videoMode.blueBits = fbconfig.blueBits;
|
window->videoMode.blueBits = fbconfig.blueBits;
|
||||||
window->videoMode.refreshRate = _glfw.hints.refreshRate;
|
window->videoMode.refreshRate = _glfw.hints.refreshRate;
|
||||||
|
|
||||||
if (wndconfig.monitor)
|
|
||||||
{
|
|
||||||
wndconfig.resizable = GL_TRUE;
|
|
||||||
wndconfig.visible = GL_TRUE;
|
|
||||||
wndconfig.focused = GL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transfer window hints that are persistent settings and not
|
|
||||||
// just initial states
|
|
||||||
window->monitor = wndconfig.monitor;
|
window->monitor = wndconfig.monitor;
|
||||||
window->resizable = wndconfig.resizable;
|
window->resizable = wndconfig.resizable;
|
||||||
window->decorated = wndconfig.decorated;
|
window->decorated = wndconfig.decorated;
|
||||||
@ -252,9 +250,6 @@ void glfwDefaultWindowHints(void)
|
|||||||
_glfw.hints.window.focused = GL_TRUE;
|
_glfw.hints.window.focused = GL_TRUE;
|
||||||
_glfw.hints.window.autoIconify = GL_TRUE;
|
_glfw.hints.window.autoIconify = GL_TRUE;
|
||||||
|
|
||||||
// The default is to select the highest available refresh rate
|
|
||||||
_glfw.hints.refreshRate = GLFW_DONT_CARE;
|
|
||||||
|
|
||||||
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil,
|
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil,
|
||||||
// double buffered
|
// double buffered
|
||||||
_glfw.hints.framebuffer.redBits = 8;
|
_glfw.hints.framebuffer.redBits = 8;
|
||||||
@ -264,6 +259,9 @@ 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 = GL_TRUE;
|
_glfw.hints.framebuffer.doublebuffer = GL_TRUE;
|
||||||
|
|
||||||
|
// The default is to select the highest available refresh rate
|
||||||
|
_glfw.hints.refreshRate = GLFW_DONT_CARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwWindowHint(int target, int hint)
|
GLFWAPI void glfwWindowHint(int target, int hint)
|
||||||
@ -308,12 +306,15 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
case GLFW_STEREO:
|
case GLFW_STEREO:
|
||||||
_glfw.hints.framebuffer.stereo = hint ? GL_TRUE : GL_FALSE;
|
_glfw.hints.framebuffer.stereo = hint ? GL_TRUE : GL_FALSE;
|
||||||
break;
|
break;
|
||||||
case GLFW_REFRESH_RATE:
|
|
||||||
_glfw.hints.refreshRate = hint;
|
|
||||||
break;
|
|
||||||
case GLFW_DOUBLEBUFFER:
|
case GLFW_DOUBLEBUFFER:
|
||||||
_glfw.hints.framebuffer.doublebuffer = hint ? GL_TRUE : GL_FALSE;
|
_glfw.hints.framebuffer.doublebuffer = hint ? GL_TRUE : GL_FALSE;
|
||||||
break;
|
break;
|
||||||
|
case GLFW_SAMPLES:
|
||||||
|
_glfw.hints.framebuffer.samples = hint;
|
||||||
|
break;
|
||||||
|
case GLFW_SRGB_CAPABLE:
|
||||||
|
_glfw.hints.framebuffer.sRGB = hint ? GL_TRUE : GL_FALSE;
|
||||||
|
break;
|
||||||
case GLFW_RESIZABLE:
|
case GLFW_RESIZABLE:
|
||||||
_glfw.hints.window.resizable = hint ? GL_TRUE : GL_FALSE;
|
_glfw.hints.window.resizable = hint ? GL_TRUE : GL_FALSE;
|
||||||
break;
|
break;
|
||||||
@ -332,12 +333,6 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
case GLFW_VISIBLE:
|
case GLFW_VISIBLE:
|
||||||
_glfw.hints.window.visible = hint ? GL_TRUE : GL_FALSE;
|
_glfw.hints.window.visible = hint ? GL_TRUE : GL_FALSE;
|
||||||
break;
|
break;
|
||||||
case GLFW_SAMPLES:
|
|
||||||
_glfw.hints.framebuffer.samples = hint;
|
|
||||||
break;
|
|
||||||
case GLFW_SRGB_CAPABLE:
|
|
||||||
_glfw.hints.framebuffer.sRGB = hint ? GL_TRUE : GL_FALSE;
|
|
||||||
break;
|
|
||||||
case GLFW_CLIENT_API:
|
case GLFW_CLIENT_API:
|
||||||
_glfw.hints.context.api = hint;
|
_glfw.hints.context.api = hint;
|
||||||
break;
|
break;
|
||||||
@ -362,6 +357,9 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
case GLFW_CONTEXT_RELEASE_BEHAVIOR:
|
case GLFW_CONTEXT_RELEASE_BEHAVIOR:
|
||||||
_glfw.hints.context.release = hint;
|
_glfw.hints.context.release = hint;
|
||||||
break;
|
break;
|
||||||
|
case GLFW_REFRESH_RATE:
|
||||||
|
_glfw.hints.refreshRate = hint;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint");
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint");
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user