| 136 | } |
| 137 | |
| 138 | int Application::Run() |
| 139 | { |
| 140 | while (true) |
| 141 | { |
| 142 | switch (MsgWaitForMultipleObjectsEx(0, nullptr, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE | MWMO_INPUTAVAILABLE)) |
| 143 | { |
| 144 | case WAIT_OBJECT_0: |
| 145 | for (MSG msg; PeekMessage(&msg, 0, 0, 0, PM_REMOVE);) |
| 146 | { |
| 147 | if (msg.message != WM_QUIT) |
| 148 | { |
| 149 | if (!m_AppWindow.PreTranslateMessage(msg)) |
| 150 | { |
| 151 | TranslateMessage(&msg); |
| 152 | DispatchMessage(&msg); |
| 153 | } |
| 154 | } |
| 155 | else |
| 156 | { |
| 157 | return static_cast<int>(msg.wParam); |
| 158 | } |
| 159 | } |
| 160 | [[fallthrough]]; |
| 161 | case WAIT_IO_COMPLETION: |
| 162 | continue; |
| 163 | |
| 164 | case WAIT_FAILED: |
| 165 | LastErrorHandle(spdlog::level::critical, L"Failed to enter alertable wait state!"); |
| 166 | |
| 167 | default: |
| 168 | MessagePrint(spdlog::level::critical, L"MsgWaitForMultipleObjectsEx returned an unexpected value!"); |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | winrt::fire_and_forget Application::Shutdown() |
| 174 | { |
no test coverage detected