зеркало из https://github.com/electron/electron.git
feat: support suspend/resume on Windows (#24251)
This commit is contained in:
Родитель
abf2e9c93d
Коммит
6369748a2a
|
@ -8,11 +8,11 @@ Process: [Main](../glossary.md#main-process)
|
|||
|
||||
The `powerMonitor` module emits the following events:
|
||||
|
||||
### Event: 'suspend'
|
||||
### Event: 'suspend' _Linux_ _Windows_
|
||||
|
||||
Emitted when the system is suspending.
|
||||
|
||||
### Event: 'resume'
|
||||
### Event: 'resume' _Linux_ _Windows_
|
||||
|
||||
Emitted when system is resuming.
|
||||
|
||||
|
|
|
@ -73,6 +73,12 @@ LRESULT CALLBACK PowerMonitor::WndProc(HWND hwnd,
|
|||
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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче