From 72ef5374259412e13650ef13df3f8998ad2620fd Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 9 Oct 2011 21:12:13 +0200 Subject: [PATCH] Added input function for window damage events. --- src/internal.h | 1 + src/win32_window.c | 4 +--- src/window.c | 11 +++++++++++ src/x11_window.c | 4 +--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/internal.h b/src/internal.h index bfe24fb0..89c77cd7 100644 --- a/src/internal.h +++ b/src/internal.h @@ -344,6 +344,7 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean activated); void _glfwInputWindowPos(_GLFWwindow* window, int x, int y); void _glfwInputWindowSize(_GLFWwindow* window, int width, int height); void _glfwInputWindowIconify(_GLFWwindow* window, int iconified); +void _glfwInputWindowDamage(_GLFWwindow* window); // Input event notification void _glfwInputKey(_GLFWwindow* window, int key, int action); diff --git a/src/win32_window.c b/src/win32_window.c index 930adccf..3442f5a3 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1069,9 +1069,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, // Was the window contents damaged? case WM_PAINT: { - if (_glfwLibrary.windowRefreshCallback) - _glfwLibrary.windowRefreshCallback(window); - + _glfwInputWindowDamage(window); break; } diff --git a/src/window.c b/src/window.c index 131e41fa..29707bd1 100644 --- a/src/window.c +++ b/src/window.c @@ -195,6 +195,17 @@ void _glfwInputWindowIconify(_GLFWwindow* window, int iconified) } +//======================================================================== +// Register window damage events +//======================================================================== + +void _glfwInputWindowDamage(_GLFWwindow* window) +{ + if (_glfwLibrary.windowRefreshCallback) + _glfwLibrary.windowRefreshCallback(window); +} + + ////////////////////////////////////////////////////////////////////////// ////// GLFW public API ////// ////////////////////////////////////////////////////////////////////////// diff --git a/src/x11_window.c b/src/x11_window.c index c08b9b36..8ec19572 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1349,9 +1349,7 @@ static void processSingleEvent(void) return; } - if (_glfwLibrary.windowRefreshCallback) - _glfwLibrary.windowRefreshCallback(window); - + _glfwInputWindowDamage(window); break; }