feat: support suspend/resume on Windows (#24251)
This commit is contained in:
parent
abf2e9c93d
commit
6369748a2a
2 changed files with 8 additions and 2 deletions
|
@ -8,11 +8,11 @@ Process: [Main](../glossary.md#main-process)
|
||||||
|
|
||||||
The `powerMonitor` module emits the following events:
|
The `powerMonitor` module emits the following events:
|
||||||
|
|
||||||
### Event: 'suspend'
|
### Event: 'suspend' _Linux_ _Windows_
|
||||||
|
|
||||||
Emitted when the system is suspending.
|
Emitted when the system is suspending.
|
||||||
|
|
||||||
### Event: 'resume'
|
### Event: 'resume' _Linux_ _Windows_
|
||||||
|
|
||||||
Emitted when system is resuming.
|
Emitted when system is resuming.
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,12 @@ LRESULT CALLBACK PowerMonitor::WndProc(HWND hwnd,
|
||||||
Emit("unlock-screen");
|
Emit("unlock-screen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (message == WM_POWERBROADCAST) {
|
||||||
|
if (wparam == PBT_APMRESUMEAUTOMATIC) {
|
||||||
|
Emit("resume");
|
||||||
|
} else if (wparam == PBT_APMSUSPEND) {
|
||||||
|
Emit("suspend");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ::DefWindowProc(hwnd, message, wparam, lparam);
|
return ::DefWindowProc(hwnd, message, wparam, lparam);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue