mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 00:30:57 +00:00
Added return by setters of previous callback.
This commit is contained in:
+3
-1
@@ -190,8 +190,10 @@ GLFWAPI const char* glfwGetVersionString(void)
|
||||
return _glfwPlatformGetVersionString();
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun)
|
||||
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
|
||||
{
|
||||
GLFWerrorfun previous = _glfwErrorCallback;
|
||||
_glfwErrorCallback = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
|
||||
+46
-12
@@ -337,45 +337,79 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
|
||||
_glfwPlatformSetCursorPos(window, xpos, ypos);
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
|
||||
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWkeyfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.key;
|
||||
window->callbacks.key = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun)
|
||||
GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWcharfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.character;
|
||||
window->callbacks.character = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow* handle, GLFWmousebuttonfun cbfun)
|
||||
GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* handle,
|
||||
GLFWmousebuttonfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWmousebuttonfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.mouseButton;
|
||||
window->callbacks.mouseButton = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetCursorPosCallback(GLFWwindow* handle, GLFWcursorposfun cbfun)
|
||||
GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* handle,
|
||||
GLFWcursorposfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWcursorposfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.cursorPos;
|
||||
window->callbacks.cursorPos = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow* handle, GLFWcursorenterfun cbfun)
|
||||
GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* handle,
|
||||
GLFWcursorenterfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWcursorenterfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.cursorEnter;
|
||||
window->callbacks.cursorEnter = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetScrollCallback(GLFWwindow* handle, GLFWscrollfun cbfun)
|
||||
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle,
|
||||
GLFWscrollfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWscrollfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.scroll;
|
||||
window->callbacks.scroll = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -289,10 +289,14 @@ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
|
||||
return monitor->name;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetMonitorCallback(GLFWmonitorfun cbfun)
|
||||
GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
|
||||
{
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWmonitorfun previous;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = _glfw.monitorCallback;
|
||||
_glfw.monitorCallback = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
||||
|
||||
+48
-12
@@ -582,46 +582,82 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* handle)
|
||||
return window->userPointer;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetWindowPosCallback(GLFWwindow* handle, GLFWwindowposfun cbfun)
|
||||
GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* handle,
|
||||
GLFWwindowposfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWwindowposfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.pos;
|
||||
window->callbacks.pos = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow* handle, GLFWwindowsizefun cbfun)
|
||||
GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* handle,
|
||||
GLFWwindowsizefun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWwindowsizefun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.size;
|
||||
window->callbacks.size = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow* handle, GLFWwindowclosefun cbfun)
|
||||
GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* handle,
|
||||
GLFWwindowclosefun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWwindowclosefun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.close;
|
||||
window->callbacks.close = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow* handle, GLFWwindowrefreshfun cbfun)
|
||||
GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* handle,
|
||||
GLFWwindowrefreshfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWwindowrefreshfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.refresh;
|
||||
window->callbacks.refresh = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow* handle, GLFWwindowfocusfun cbfun)
|
||||
GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* handle,
|
||||
GLFWwindowfocusfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWwindowfocusfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.focus;
|
||||
window->callbacks.focus = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow* handle, GLFWwindowiconifyfun cbfun)
|
||||
GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* handle,
|
||||
GLFWwindowiconifyfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT();
|
||||
GLFWwindowiconifyfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.iconify;
|
||||
window->callbacks.iconify = cbfun;
|
||||
return previous;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwPollEvents(void)
|
||||
|
||||
Reference in New Issue
Block a user