From ae3225a4e7ef86d159fdf27834c453ffcd4da76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Tue, 2 Aug 2022 20:10:35 +0200 Subject: Implement draggable split. Next step is to allow a double click to reset the split to be automatically resized. --- c/common.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'c/common.cpp') diff --git a/c/common.cpp b/c/common.cpp index 2e16c59..fcf1da2 100644 --- a/c/common.cpp +++ b/c/common.cpp @@ -148,3 +148,17 @@ int EBMessageBox(const wchar_t* const wszText, const wchar_t* const wszCaption, require(UnhookWindowsHookEx(hHook)); return r; } + +int GetRelativeCursorPos(HWND hWnd, POINT* pt) +{ + RECT rc; + if (!GetClientRect(hWnd, &rc)) return 0; + SetLastError(ERROR_SUCCESS); + if (!MapWindowPoints(hWnd, NULL, (POINT*)&rc, 2)) return 0; + + POINT ptMouse; + if (!GetCursorPos(&ptMouse)) return 0; + pt->x = ptMouse.x-rc.left; + pt->y = ptMouse.y-rc.top; + return 1; +} -- cgit v1.2.3