Allow using None for wait_events to mean no timeout

This commit is contained in:
Kovid Goyal 2016-11-30 07:36:46 +05:30
parent ec53436565
commit 3604b8c3e5

View File

@ -157,7 +157,10 @@ glfw_swap_interval(PyObject UNUSED *self, PyObject *args) {
PyObject* PyObject*
glfw_wait_events(PyObject UNUSED *self, PyObject *args) { glfw_wait_events(PyObject UNUSED *self, PyObject *args) {
double time = -1; double time = -1;
if(!PyArg_ParseTuple(args, "|d", &time)) return NULL; if (PyTuple_GET_SIZE(args) > 0) {
time = PyFloat_AsDouble(PyTuple_GET_ITEM(args, 0));
if (PyErr_Occurred()) PyErr_Clear();
}
Py_BEGIN_ALLOW_THREADS; Py_BEGIN_ALLOW_THREADS;
if (time < 0) glfwWaitEvents(); if (time < 0) glfwWaitEvents();
else glfwWaitEventsTimeout(time); else glfwWaitEventsTimeout(time);