From 3e273ac26b6c51f66fb36ce86779100b34141004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Fatay=20Yi=C4=9Fit?= Date: Fri, 1 Sep 2023 14:53:30 +0300 Subject: [PATCH] Mouse drag for each window Co-authored-by: lewar73 --- include/GLFW/glfw3.h | 2 +- src/win32_window.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 6b667d01..46bb8133 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -6201,7 +6201,7 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); GLFWAPI int glfwVulkanSupported(void); #ifdef ZD_GLFW_FORK -typedef int(*glfwMouseDragCheckFn)(); +typedef int(*glfwMouseDragCheckFn)(GLFWwindow* window); GLFWAPI void SetMouseDragCheckFn(glfwMouseDragCheckFn function); GLFWAPI void glfwGetBorder(int* border); #endif diff --git a/src/win32_window.c b/src/win32_window.c index da55c04b..ab8f2cba 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -82,7 +82,7 @@ void adjust_maximized_client_rect(HWND window, NCCALCSIZE_PARAMS* params) { params->rgrc[0] = monitor_info.rcWork; } -LRESULT hit_test(HWND handle, POINT cursor) { +LRESULT hit_test(_GLFWwindow* wnd, HWND handle, POINT cursor) { // identify borders and corners to allow resizing the window. // Note: On Windows 10, windows behave differently and // allow resizing outside the visible window frame. @@ -96,7 +96,7 @@ LRESULT hit_test(HWND handle, POINT cursor) { return HTNOWHERE; } - const int64_t drag = checkDragFunction ? (checkDragFunction() ? HTCAPTION : HTCLIENT) : HTCLIENT; + const int64_t drag = checkDragFunction ? (checkDragFunction((GLFWwindow*) wnd) ? HTCAPTION : HTCLIENT) : HTCLIENT; enum region_mask { client = 0b0000, @@ -665,7 +665,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l POINT cursor; cursor.x = GET_X_LPARAM(lParam); cursor.y = GET_Y_LPARAM(lParam); - return hit_test(hWnd, cursor); + return hit_test(window, hWnd, cursor); } break; }