mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-26 20:28:49 -05:00
Fix value checks failing on GLFW_DONT_CARE
This commit is contained in:
parent
c4c99727c5
commit
54cb23d234
27
src/window.c
27
src/window.c
|
@ -527,12 +527,28 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* handle,
|
|||
|
||||
_GLFW_REQUIRE_INIT();
|
||||
|
||||
if (minwidth < 0 || minheight < 0 ||
|
||||
if (minwidth != GLFW_DONT_CARE && minheight != GLFW_DONT_CARE)
|
||||
{
|
||||
if (minwidth < 0 || minheight < 0)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE,
|
||||
"Invalid window minimum size %ix%i",
|
||||
minwidth, minheight);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxwidth != GLFW_DONT_CARE && maxheight != GLFW_DONT_CARE)
|
||||
{
|
||||
if (maxwidth < 0 || maxheight < 0 ||
|
||||
maxwidth < minwidth || maxheight < minheight)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid window size limits");
|
||||
_glfwInputError(GLFW_INVALID_VALUE,
|
||||
"Invalid window maximum size %ix%i",
|
||||
maxwidth, maxheight);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
window->minwidth = minwidth;
|
||||
window->minheight = minheight;
|
||||
|
@ -554,11 +570,16 @@ GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* handle, int numer, int denom)
|
|||
|
||||
_GLFW_REQUIRE_INIT();
|
||||
|
||||
if (numer != GLFW_DONT_CARE && denom != GLFW_DONT_CARE)
|
||||
{
|
||||
if (numer <= 0 || denom <= 0)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid window aspect ratio");
|
||||
_glfwInputError(GLFW_INVALID_VALUE,
|
||||
"Invalid window aspect ratio %i:%i",
|
||||
numer, denom);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
window->numer = numer;
|
||||
window->denom = denom;
|
||||
|
|
Loading…
Reference in New Issue
Block a user