Added window position callback.
diff --git a/src/internal.h b/src/internal.h index c5a40af..2ef8f10 100644 --- a/src/internal.h +++ b/src/internal.h
@@ -199,6 +199,7 @@ int glRobustness; PFNGLGETSTRINGIPROC GetStringi; + GLFWwindowposfun windowPosCallback; GLFWwindowsizefun windowSizeCallback; GLFWwindowclosefun windowCloseCallback; GLFWwindowrefreshfun windowRefreshCallback;
diff --git a/src/window.c b/src/window.c index 908a2a7..ac0fd02 100644 --- a/src/window.c +++ b/src/window.c
@@ -119,8 +119,14 @@ void _glfwInputWindowPos(_GLFWwindow* window, int x, int y) { + if (window->positionX == x && window->positionY == y) + return; + window->positionX = x; window->positionY = y; + + if (window->windowPosCallback) + window->windowPosCallback(window, x, y); } @@ -765,6 +771,24 @@ //======================================================================== +// Set callback function for window position changes +//======================================================================== + +GLFWAPI void glfwSetWindowPosCallback(GLFWwindow handle, GLFWwindowposfun cbfun) +{ + _GLFWwindow* window = (_GLFWwindow*) handle; + + if (!_glfwInitialized) + { + _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + return; + } + + window->windowPosCallback = cbfun; +} + + +//======================================================================== // Set callback function for window size changes //========================================================================