feat: support suspend/resume on Windows (#24251)

This commit is contained in:
Shelley Vohr 2020-06-24 07:28:29 -07:00 committed by GitHub
parent abf2e9c93d
commit 6369748a2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -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);
}