1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 10:48:51 -05:00

Added error setting for more cases of invalid tokens.

This commit is contained in:
Camilla Berglund 2011-10-08 23:41:30 +02:00
parent 0544afeb06
commit 1960d1ebb1
3 changed files with 7 additions and 6 deletions

View File

@ -152,6 +152,7 @@ GLFWAPI void glfwEnable(GLFWwindow window, int token)
enableKeyRepeat(window); enableKeyRepeat(window);
break; break;
default: default:
_glfwSetError(GLFW_INVALID_ENUM, NULL);
break; break;
} }
} }
@ -184,6 +185,7 @@ GLFWAPI void glfwDisable(GLFWwindow window, int token)
disableKeyRepeat(window); disableKeyRepeat(window);
break; break;
default: default:
_glfwSetError(GLFW_INVALID_ENUM, NULL);
break; break;
} }
} }

View File

@ -53,7 +53,7 @@ GLFWAPI int glfwGetKey(GLFWwindow handle, int key)
if (key < 0 || key > GLFW_KEY_LAST) if (key < 0 || key > GLFW_KEY_LAST)
{ {
// TODO: Decide whether key is a value or enum // TODO: Decide whether key is a value or enum
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_ENUM,
"glfwGetKey: The specified key is invalid"); "glfwGetKey: The specified key is invalid");
return GLFW_RELEASE; return GLFW_RELEASE;
} }

View File

@ -468,6 +468,7 @@ GLFWAPI void glfwOpenWindowHint(int target, int hint)
_glfwLibrary.hints.glRobustness = hint; _glfwLibrary.hints.glRobustness = hint;
break; break;
default: default:
_glfwSetError(GLFW_INVALID_ENUM, NULL);
break; break;
} }
} }
@ -748,12 +749,10 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
return window->glProfile; return window->glProfile;
case GLFW_OPENGL_ROBUSTNESS: case GLFW_OPENGL_ROBUSTNESS:
return window->glRobustness; return window->glRobustness;
default:
_glfwSetError(GLFW_INVALID_ENUM,
"glfwGetWindowParam: Invalid enum value for 'param' "
"parameter");
return 0;
} }
_glfwSetError(GLFW_INVALID_ENUM, NULL);
return 0;
} }