Skip to content

Commit d6fe961

Browse files
committed
chore: bump version
1 parent 8f4e9ba commit d6fe961

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

lib/windows.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ T getValueFromCallbackData(const Napi::CallbackInfo &info,
2828

2929
std::string toUtf8(const std::wstring &str) {
3030
std::string ret;
31-
int len = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.length(), NULL, 0, NULL, NULL);
31+
int len = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.length(), NULL,
32+
0, NULL, NULL);
3233
if (len > 0) {
3334
ret.resize(len);
34-
WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.length(), &ret[0], len, NULL, NULL);
35+
WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.length(), &ret[0], len,
36+
NULL, NULL);
3537
}
3638
return ret;
3739
}
@@ -51,7 +53,6 @@ Process getWindowProcess(HWND handle) {
5153
return {static_cast<int>(pid), path};
5254
}
5355

54-
5556
Napi::Object getActiveWindow(const Napi::CallbackInfo &info) {
5657
Napi::Env env{info.Env()};
5758

@@ -85,7 +86,7 @@ Napi::Array getWindows(const Napi::CallbackInfo &info) {
8586

8687
for (int i = 0; i < _windows.size(); i++) {
8788
auto obj{Napi::Object::New(env)};
88-
89+
8990
obj.Set("id", _windows[i].id);
9091
obj.Set("processId", _windows[i].process.pid);
9192
obj.Set("path", _windows[i].process.path);
@@ -96,7 +97,6 @@ Napi::Array getWindows(const Napi::CallbackInfo &info) {
9697
return arr;
9798
}
9899

99-
100100
Napi::Number getMonitorFromWindow(const Napi::CallbackInfo &info) {
101101
Napi::Env env{info.Env()};
102102

@@ -234,6 +234,9 @@ Napi::Boolean bringWindowToTop(const Napi::CallbackInfo &info) {
234234

235235
auto handle{getValueFromCallbackData<HWND>(info, 0)};
236236
BOOL b{SetForegroundWindow(handle)};
237+
SetActiveWindow(handle);
238+
SetWindowPos(handle, HWND_TOP, 0, 0, 0, 0,
239+
SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
237240

238241
return Napi::Boolean::New(env, b);
239242
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-window-manager",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Manage windows in macOS, Windows and Linux",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/classes/window.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,14 @@ export class Window {
173173

174174
getOwner() {
175175
if (!addon || platform() !== "win32") return;
176-
return this.getInfo().owner;
176+
return new Window(this.getInfo().owner);
177177
}
178178

179179
getInfo(): WindowInfo {
180180
if (!addon) return;
181181

182182
const info = addon.getWindowInfo(this.id);
183183

184-
if (platform() === "win32") {
185-
info.owner = new Window(info.owner);
186-
}
187-
188184
return info;
189185
}
190186
}

0 commit comments

Comments
 (0)