| 68 | |
| 69 | #ifdef _WIN32 |
| 70 | LRESULT CALLBACK SessionMonitorWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { |
| 71 | switch (uMsg) { |
| 72 | case WM_CLOSE: |
| 73 | DestroyWindow(hwnd); |
| 74 | return 0; |
| 75 | case WM_DESTROY: |
| 76 | PostQuitMessage(0); |
| 77 | return 0; |
| 78 | case WM_ENDSESSION: |
| 79 | { |
| 80 | // Terminate ourselves with a blocking exit call |
| 81 | std::cout << "Received WM_ENDSESSION"sv << std::endl; |
| 82 | lifetime::exit_sunshine(0, false); |
| 83 | return 0; |
| 84 | } |
| 85 | default: |
| 86 | return DefWindowProc(hwnd, uMsg, wParam, lParam); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | WINAPI BOOL ConsoleCtrlHandler(DWORD type) { |
| 91 | if (type == CTRL_CLOSE_EVENT) { |
nothing calls this directly
no test coverage detected