Files
Exiled-Exchange-2/patches/node-window-manager+2.0.1.patch
T
2020-04-23 03:54:57 +03:00

37 lines
1.2 KiB
Diff

diff --git a/node_modules/node-window-manager/lib/windows.cc b/node_modules/node-window-manager/lib/windows.cc
index 965b87c..3c9e705 100644
--- a/node_modules/node-window-manager/lib/windows.cc
+++ b/node_modules/node-window-manager/lib/windows.cc
@@ -39,6 +39,8 @@ Process getWindowProcess (HWND handle) {
QueryFullProcessImageNameW (pHandle, 0, exeName, &dwSize);
+ CloseHandle(pHandle);
+
auto wspath (exeName);
auto path = toUtf8 (wspath);
@@ -129,14 +131,17 @@ Napi::Object getWindowBounds (const Napi::CallbackInfo& info) {
auto handle{ getValueFromCallbackData<HWND> (info, 0) };
RECT rect{};
- GetWindowRect (handle, &rect);
+ GetClientRect (handle, &rect);
+
+ POINT ptClientUL{ rect.left, rect.top };
+ ClientToScreen (handle, &ptClientUL);
Napi::Object bounds{ Napi::Object::New (env) };
- bounds.Set ("x", rect.left);
- bounds.Set ("y", rect.top);
- bounds.Set ("width", rect.right - rect.left);
- bounds.Set ("height", rect.bottom - rect.top);
+ bounds.Set ("x", ptClientUL.x);
+ bounds.Set ("y", ptClientUL.y);
+ bounds.Set ("width", rect.right);
+ bounds.Set ("height", rect.bottom);
return bounds;
}