| 443 | } |
| 444 | |
| 445 | LRESULT CALLBACK WinAppProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) |
| 446 | { |
| 447 | static bool receivedWmClose = false; |
| 448 | |
| 449 | // Disables ALT + SPACE |
| 450 | if (msg == WM_SYSCOMMAND && wParam == SC_KEYMENU) |
| 451 | { |
| 452 | return 0; |
| 453 | } |
| 454 | |
| 455 | if (msg == WM_SETCURSOR) |
| 456 | { |
| 457 | if (LOWORD(lParam) == HTCLIENT) |
| 458 | { |
| 459 | SetCursor(g_Renderer.IsFullsScreen() ? nullptr : App.WindowClass.hCursor); |
| 460 | return 1; |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | if (msg == WM_ACTIVATEAPP) |
| 465 | { |
| 466 | App.ResetClock = true; |
| 467 | return DefWindowProcA(hWnd, msg, wParam, (LPARAM)lParam); |
| 468 | } |
| 469 | |
| 470 | if (msg > WM_CLOSE) |
| 471 | { |
| 472 | if (msg == WM_COMMAND) |
| 473 | HandleWmCommand((unsigned short)wParam); |
| 474 | |
| 475 | return DefWindowProcA(hWnd, msg, wParam, (LPARAM)lParam); |
| 476 | } |
| 477 | |
| 478 | if (msg == WM_CLOSE) |
| 479 | { |
| 480 | receivedWmClose = true; |
| 481 | PostQuitMessage(0); |
| 482 | DoTheGame = false; |
| 483 | |
| 484 | return DefWindowProcA(hWnd, 0x10u, wParam, (LPARAM)lParam); |
| 485 | } |
| 486 | |
| 487 | if (msg != WM_ACTIVATE) |
| 488 | return DefWindowProcA(hWnd, msg, wParam, (LPARAM)lParam); |
| 489 | |
| 490 | if (receivedWmClose) |
| 491 | { |
| 492 | return DefWindowProcA(hWnd, msg, wParam, (LPARAM)lParam); |
| 493 | } |
| 494 | |
| 495 | if ((short)wParam) |
| 496 | { |
| 497 | if ((signed int)(unsigned short)wParam > 0 && (signed int)(unsigned short)wParam <= 2) |
| 498 | { |
| 499 | SetInputLockState(false); |
| 500 | |
| 501 | if (!g_Configuration.EnableWindowedMode) |
| 502 | g_Renderer.ToggleFullScreen(true); |
nothing calls this directly
no test coverage detected