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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2020-06-29 09:07:16 -07:00
committed by GitHub
parent d8de43f534
commit d580cc1578
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);
}