| 1 | |
| 2 | |
| 3 | void CMainWorker::WorkerInt() |
| 4 | { |
| 5 | IFW_LOG(SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL)); |
| 6 | |
| 7 | COM::CAutoCOMInitialize autoCom; |
| 8 | IFS_LOG(autoCom.Init()); |
| 9 | |
| 10 | WorkerImplement& workerImpl = *worker_impl.get(); |
| 11 | |
| 12 | bool exit = false; |
| 13 | while (!exit) { |
| 14 | auto msg = m_queue.GetMessageWait(); |
| 15 | std::visit([&workerImpl, &exit](auto&& arg) { |
| 16 | using T = std::decay_t<decltype(arg)>; |
| 17 | if constexpr (std::is_same_v<T, Message_KeyType>) { |
| 18 | workerImpl.ProcessKeyMsg(arg); |
| 19 | } |
| 20 | else if constexpr (std::is_same_v<T, Message_Hotkey>) { |
| 21 | workerImpl.ProcessOurHotKey(std::move(arg)); |
| 22 | } |
| 23 | else if constexpr (std::is_same_v<T, Message_ChangeForeg>) { |
| 24 | workerImpl.ChangeForeground(arg.hwnd); |
| 25 | } |
| 26 | else if constexpr (std::is_same_v<T, Message_ClearWorlds>) { |
| 27 | workerImpl.ClearAllWords(); |
| 28 | } |
| 29 | else if constexpr (std::is_same_v<T, Message_Func>) { |
| 30 | arg(&workerImpl); |
| 31 | } |
| 32 | else if constexpr (std::is_same_v<T, Message_Quit>) { |
| 33 | exit = true; |
| 34 | } |
| 35 | }, msg); |
| 36 | } |
| 37 | |
| 38 | LOG_ANY(L"Exit main worker"); |
| 39 | } |
| 40 | |
| 41 | void CMainWorker::Init() { |
| 42 | worker_impl = MAKE_UNIQUE(worker_impl); |
nothing calls this directly
no test coverage detected