diff --git a/.vscode/custom.code-snippets b/.vscode/custom.code-snippets index c191c9ff..2ce2c228 100644 --- a/.vscode/custom.code-snippets +++ b/.vscode/custom.code-snippets @@ -12,7 +12,7 @@ "scope": "c,cpp", "prefix": "dlog", "body": [ - "OutputDebugString(L\"$0\");", + "OutputDebugString(L\"[msime]: $0\");", ], "description": "Debugview log" }, @@ -20,7 +20,7 @@ "scope": "c,cpp", "prefix": "flog", "body": [ - "OutputDebugString(fmt::format(L\"$0\").c_str());", + "OutputDebugString(fmt::format(L\"[msime]: $0\").c_str());", ], "description": "Debugview log with fmt" } diff --git a/src/Composition/Composition.cpp b/src/Composition/Composition.cpp index 1e682b43..c52ed6f4 100644 --- a/src/Composition/Composition.cpp +++ b/src/Composition/Composition.cpp @@ -71,9 +71,6 @@ void CMetasequoiaIME::_SetComposition(_In_ ITfComposition *pComposition) HRESULT CMetasequoiaIME::_AddComposingAndChar(TfEditCookie ec, _In_ ITfContext *pContext, _In_ CStringRange *pstrAddString) { -#ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"You entered _AddComposingAndChar{}\n", pstrAddString->Get()).c_str()); -#endif HRESULT hr = S_OK; ULONG fetched = 0; diff --git a/src/Composition/CompositionProcessorEngine.cpp b/src/Composition/CompositionProcessorEngine.cpp index 84d0dc31..e6d60601 100644 --- a/src/Composition/CompositionProcessorEngine.cpp +++ b/src/Composition/CompositionProcessorEngine.cpp @@ -1289,10 +1289,6 @@ BOOL CCompositionProcessorEngine::SetupDictionaryFile() dictionaryDbPathW = pwszDBFileName; -#ifdef FANY_DEBUG - OutputDebugString(pwszDBFileName); -#endif - // create CFileMapping object if (_pDictionaryFile == nullptr) { @@ -1924,7 +1920,7 @@ BOOL CCompositionProcessorEngine::IsVirtualKeyNeed( // if (IsVirtualKeyKeystrokeComposition(uCode, pKeyState, FUNCTION_NONE)) // 26 basic English chars { #ifdef FANY_DEBUG - OutputDebugString(L"Basic 26 chars key pressed.\n"); + OutputDebugString(L"[msime]: Basic 26 chars key pressed.\n"); #endif return TRUE; } @@ -2154,7 +2150,7 @@ BOOL CCompositionProcessorEngine::IsVirtualKeyNeed( // case VK_RETURN: // Do something when user press return key #ifdef FANY_DEBUG - OutputDebugString(L"VK_RETURN pressed.\n"); + OutputDebugString(L"[msime]: VK_RETURN pressed.\n"); #endif if (pKeyState) { @@ -2537,7 +2533,7 @@ BOOL CCompositionProcessorEngine::IsVirtualKeyNeed( // } #ifdef FANY_DEBUG - OutputDebugString(L"Unknown keystroke."); + OutputDebugString(L"[msime]: Unknown keystroke."); #endif return FALSE; } @@ -2555,8 +2551,8 @@ BOOL CCompositionProcessorEngine::IsVirtualKeyKeystrokeComposition( // ) { #ifdef FANY_DEBUG - OutputDebugString(L"Fany Here: IsVirtualKeyKeystrokeComposition 26."); - std::wstring modifiers = fmt::format(L"Global Modifiers: {}", Global::ModifiersValue); + OutputDebugString(L"[msime]: Fany Here: IsVirtualKeyKeystrokeComposition 26."); + std::wstring modifiers = fmt::format(L"[msime]: Global Modifiers: {}", Global::ModifiersValue); OutputDebugString(modifiers.c_str()); #endif if (pKeyState == nullptr) @@ -2695,7 +2691,7 @@ BOOL CCompositionProcessorEngine::IsKeystrokeRange(UINT uCode, _Out_ _KEYSTROKE_ else if (GetVirtualKeyLength() > 0) { #ifdef FANY_DEBUG - OutputDebugString(L"GetVirtualKeyLength() > 0"); + OutputDebugString(L"[msime]: GetVirtualKeyLength() > 0"); #endif pKeyState->Category = CATEGORY_CANDIDATE; pKeyState->Function = FUNCTION_SELECT_BY_NUMBER; diff --git a/src/IME/MetasequoiaIME.cpp b/src/IME/MetasequoiaIME.cpp index c847518e..55df311e 100644 --- a/src/IME/MetasequoiaIME.cpp +++ b/src/IME/MetasequoiaIME.cpp @@ -258,7 +258,7 @@ STDAPI CMetasequoiaIME::ActivateEx(ITfThreadMgr *pThreadMgr, TfClientId tfClient _dwActivateFlags = dwFlags; #ifdef FANY_DEBUG - OutputDebugString(L"CMetasequoiaIME::ActivateEx\n"); + OutputDebugString(L"[msime]: CMetasequoiaIME::ActivateEx\n"); #endif /* std::wstring processName = FanyUtils::GetCurrentProcessName(); @@ -360,7 +360,7 @@ STDAPI CMetasequoiaIME::ActivateEx(ITfThreadMgr *pThreadMgr, TfClientId tfClient if (awareness == DPI_AWARENESS_UNAWARE) { #ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"awareness == DPI_AWARENESS_UNAWARE").c_str()); + OutputDebugString(fmt::format(L"[msime]: awareness == DPI_AWARENESS_UNAWARE").c_str()); #endif /* 宿主是非感知程序,需要反向缩放 */ DPI_AWARENESS_CONTEXT oldCtx = SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE); @@ -370,13 +370,13 @@ STDAPI CMetasequoiaIME::ActivateEx(ITfThreadMgr *pThreadMgr, TfClientId tfClient SetThreadDpiAwarenessContext(oldCtx); Global::DpiScale = dpiX / 96.0; #ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"Global::DpiScale: {}", Global::DpiScale).c_str()); + OutputDebugString(fmt::format(L"[msime]: Global::DpiScale: {}", Global::DpiScale).c_str()); #endif } } #ifdef FANY_DEBUG - OutputDebugString(L"CMetasequoiaIME::ActivateEx\n"); + OutputDebugString(L"[msime]: CMetasequoiaIME::ActivateEx\n"); #endif return S_OK; @@ -414,7 +414,7 @@ STDAPI CMetasequoiaIME::Deactivate() { // 向 server 端发送一个输入法真的切换到了别的输入法的消息 // 只有接收到这个消息,才可以隐藏 ftb - OutputDebugString(fmt::format(L"Truely deactivate IME and switch to another.\n").c_str()); + OutputDebugString(fmt::format(L"[msime]: Truely deactivate IME and switch to another.\n").c_str()); SendIMEDeactivationEventToUIProcessViaNamedPipe(); } @@ -439,7 +439,7 @@ STDAPI CMetasequoiaIME::Deactivate() // CloseNamedpipe(); #ifdef FANY_DEBUG - OutputDebugString(L"CMetasequoiaIME::Deactivate\n"); + OutputDebugString(L"[msime]: CMetasequoiaIME::Deactivate\n"); #endif if (_pCompositionProcessorEngine) @@ -556,7 +556,7 @@ void CMetasequoiaIME::IpcWorkerThread(CMetasequoiaIME *pIME) WM_CheckGlobalCompartment, // Global::DataToTsfWorkerThreadMsgType::SwitchToEnglish, // 0); - OutputDebugString(fmt::format(L"Switch to English").c_str()); + OutputDebugString(fmt::format(L"[msime]: Switch to English").c_str()); } else if (buf.msg_type == Global::DataToTsfWorkerThreadMsgType::SwitchToChinese) { @@ -565,7 +565,7 @@ void CMetasequoiaIME::IpcWorkerThread(CMetasequoiaIME *pIME) WM_CheckGlobalCompartment, // Global::DataToTsfWorkerThreadMsgType::SwitchToChinese, // 0); - OutputDebugString(fmt::format(L"Switch to Chinese").c_str()); + OutputDebugString(fmt::format(L"[msime]: Switch to Chinese").c_str()); } else if (buf.msg_type == Global::DataToTsfWorkerThreadMsgType::SwitchToPuncEn) { @@ -574,7 +574,7 @@ void CMetasequoiaIME::IpcWorkerThread(CMetasequoiaIME *pIME) WM_CheckGlobalCompartment, // Global::DataToTsfWorkerThreadMsgType::SwitchToPuncEn, // 0); - OutputDebugString(fmt::format(L"Switch to Punc En").c_str()); + OutputDebugString(fmt::format(L"[msime]: Switch to Punc En").c_str()); } else if (buf.msg_type == Global::DataToTsfWorkerThreadMsgType::SwitchToPuncCn) { @@ -583,7 +583,7 @@ void CMetasequoiaIME::IpcWorkerThread(CMetasequoiaIME *pIME) WM_CheckGlobalCompartment, // Global::DataToTsfWorkerThreadMsgType::SwitchToPuncCn, // 0); - OutputDebugString(fmt::format(L"Switch to Punc Cn").c_str()); + OutputDebugString(fmt::format(L"[msime]: Switch to Punc Cn").c_str()); } else if (buf.msg_type == Global::DataToTsfWorkerThreadMsgType::SwitchToFullwidth) { @@ -592,7 +592,7 @@ void CMetasequoiaIME::IpcWorkerThread(CMetasequoiaIME *pIME) WM_CheckGlobalCompartment, // Global::DataToTsfWorkerThreadMsgType::SwitchToFullwidth, // 0); - OutputDebugString(fmt::format(L"Switch to Fullwidth").c_str()); + OutputDebugString(fmt::format(L"[msime]: Switch to Fullwidth").c_str()); } else if (buf.msg_type == Global::DataToTsfWorkerThreadMsgType::SwitchToHalfwidth) { @@ -601,7 +601,7 @@ void CMetasequoiaIME::IpcWorkerThread(CMetasequoiaIME *pIME) WM_CheckGlobalCompartment, // Global::DataToTsfWorkerThreadMsgType::SwitchToHalfwidth, // 0); - OutputDebugString(fmt::format(L"Switch to Halfwidth").c_str()); + OutputDebugString(fmt::format(L"[msime]: Switch to Halfwidth").c_str()); } } Sleep(100); @@ -626,43 +626,43 @@ LRESULT CALLBACK CMetasequoiaIME_WindowProc(HWND hWnd, UINT message, WPARAM wPar case WM_CheckGlobalCompartment: { if (wParam == Global::DataToTsfWorkerThreadMsgType::SwitchToEnglish) { - OutputDebugString(fmt::format(L"Wnd Switch to English").c_str()); + OutputDebugString(fmt::format(L"[msime]: Wnd Switch to English").c_str()); pIME->GetCompositionProcessorEngine()->SetIMEMode(pIME->_GetThreadMgr(), pIME->_GetClientId(), FALSE); } else if (wParam == Global::DataToTsfWorkerThreadMsgType::SwitchToChinese) { - OutputDebugString(fmt::format(L"Wnd Switch to Chinese").c_str()); + OutputDebugString(fmt::format(L"[msime]: Wnd Switch to Chinese").c_str()); pIME->GetCompositionProcessorEngine()->SetIMEMode(pIME->_GetThreadMgr(), pIME->_GetClientId(), TRUE); - OutputDebugString(fmt::format(L"Switch to Chinese").c_str()); + OutputDebugString(fmt::format(L"[msime]: Switch to Chinese").c_str()); } else if (wParam == Global::DataToTsfWorkerThreadMsgType::SwitchToPuncEn) { - OutputDebugString(fmt::format(L"Wnd Switch to Punc En").c_str()); + OutputDebugString(fmt::format(L"[msime]: Wnd Switch to Punc En").c_str()); pIME->GetCompositionProcessorEngine()->SetPunctuationMode(pIME->_GetThreadMgr(), pIME->_GetClientId(), FALSE); } else if (wParam == Global::DataToTsfWorkerThreadMsgType::SwitchToPuncCn) { - OutputDebugString(fmt::format(L"Wnd Switch to Punc Cn").c_str()); + OutputDebugString(fmt::format(L"[msime]: Wnd Switch to Punc Cn").c_str()); pIME->GetCompositionProcessorEngine()->SetPunctuationMode(pIME->_GetThreadMgr(), pIME->_GetClientId(), TRUE); } else if (wParam == Global::DataToTsfWorkerThreadMsgType::SwitchToFullwidth) { - OutputDebugString(fmt::format(L"Wnd Switch to Fullwidth").c_str()); + OutputDebugString(fmt::format(L"[msime]: Wnd Switch to Fullwidth").c_str()); pIME->GetCompositionProcessorEngine()->SetDoubleSingleByteMode(pIME->_GetThreadMgr(), pIME->_GetClientId(), TRUE); } else if (wParam == Global::DataToTsfWorkerThreadMsgType::SwitchToHalfwidth) { - OutputDebugString(fmt::format(L"Wnd Switch to Halfwidth").c_str()); + OutputDebugString(fmt::format(L"[msime]: Wnd Switch to Halfwidth").c_str()); pIME->GetCompositionProcessorEngine()->SetDoubleSingleByteMode(pIME->_GetThreadMgr(), pIME->_GetClientId(), FALSE); } break; } case WM_ConnectNamedpipe: { - OutputDebugString(fmt::format(L"Try to connect named pipe via WM_ConnectNamedpipe").c_str()); + OutputDebugString(fmt::format(L"[msime]: Try to connect named pipe via WM_ConnectNamedpipe").c_str()); KillTimer(hWnd, TIMER_CONNECT_ALL_NAMEDPIPE); g_connectAllNamedpipeRetryCount = 0; SendToAuxNamedpipe(L"kill"); @@ -671,7 +671,7 @@ LRESULT CALLBACK CMetasequoiaIME_WindowProc(HWND hWnd, UINT message, WPARAM wPar break; } case WM_DisconnectNamedpipe: { - OutputDebugString(fmt::format(L"WM_DisconnectNamedpipe.\n").c_str()); + OutputDebugString(fmt::format(L"[msime]: WM_DisconnectNamedpipe.\n").c_str()); KillTimer(hWnd, TIMER_CONNECT_ALL_NAMEDPIPE); KillTimer(hWnd, TIMER_CONNECT_TO_TSF_NAMEDPIPE); g_connectAllNamedpipeRetryCount = 0; @@ -680,7 +680,7 @@ LRESULT CALLBACK CMetasequoiaIME_WindowProc(HWND hWnd, UINT message, WPARAM wPar break; } case WM_ConnectToTsfNamedpipe: { - OutputDebugString(fmt::format(L"Try to Connect to TSF named pipe").c_str()); + OutputDebugString(fmt::format(L"[msime]: Try to Connect to TSF named pipe").c_str()); KillTimer(hWnd, TIMER_CONNECT_TO_TSF_NAMEDPIPE); g_connectToTsfNamedpipeRetryCount = 0; // Keep old behavior: wait once before first connect try, but do it asynchronously. @@ -699,12 +699,12 @@ LRESULT CALLBACK CMetasequoiaIME_WindowProc(HWND hWnd, UINT message, WPARAM wPar } OutputDebugString( - fmt::format(L"Retry connect all named pipes: {}", g_connectAllNamedpipeRetryCount).c_str()); + fmt::format(L"[msime]: Retry connect all named pipes: {}", g_connectAllNamedpipeRetryCount).c_str()); if (ConnectToAllNamedpipe()) { KillTimer(hWnd, TIMER_CONNECT_ALL_NAMEDPIPE); g_connectAllNamedpipeRetryCount = 0; - OutputDebugString(fmt::format(L"Yes Connected to named pipe :)").c_str()); + OutputDebugString(fmt::format(L"[msime]: Yes Connected to named pipe :)").c_str()); break; } @@ -720,7 +720,8 @@ LRESULT CALLBACK CMetasequoiaIME_WindowProc(HWND hWnd, UINT message, WPARAM wPar if (wParam == TIMER_CONNECT_TO_TSF_NAMEDPIPE) { OutputDebugString( - fmt::format(L"Retry connect to tsf named pipe: {}", g_connectToTsfNamedpipeRetryCount).c_str()); + fmt::format(L"[msime]: Retry connect to tsf named pipe: {}", g_connectToTsfNamedpipeRetryCount) + .c_str()); if (ConnectToTsfNamedpipe()) { KillTimer(hWnd, TIMER_CONNECT_TO_TSF_NAMEDPIPE); diff --git a/src/IPC/Ipc.cpp b/src/IPC/Ipc.cpp index ae428234..cf9e676d 100644 --- a/src/IPC/Ipc.cpp +++ b/src/IPC/Ipc.cpp @@ -470,7 +470,7 @@ void SendToNamedpipe() // Global::hToTsfWorkerThreadPipe = INVALID_HANDLE_VALUE; /* 向 Server 端发送 kill 同时重置两个管道的 connect */ SendToAuxNamedpipe(L"kill"); - OutputDebugString(fmt::format(L"SendToNamedpipe failed eventually01.").c_str()); + OutputDebugString(fmt::format(L"[msime]: SendToNamedpipe failed eventually01.").c_str()); // } // @@ -498,7 +498,7 @@ void SendToNamedpipe() if (hPipe == INVALID_HANDLE_VALUE) { // TODO: Log - OutputDebugString(fmt::format(L"SendToNamedpipe failed eventually02.").c_str()); + OutputDebugString(fmt::format(L"[msime]: SendToNamedpipe failed eventually02.").c_str()); return; } else @@ -518,7 +518,7 @@ void SendToNamedpipe() if (!ret || bytesWritten != sizeof(namedpipeData)) { // TODO: Error handling - OutputDebugString(fmt::format(L"SendToNamedpipe failed eventually03.").c_str()); + OutputDebugString(fmt::format(L"[msime]: SendToNamedpipe failed eventually03.").c_str()); } return; @@ -638,13 +638,13 @@ struct FanyImeNamedpipeDataToTsf *TryReadDataFromServerPipeWithTimeout() { // TODO: Do not log #ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"current waited: {}", waited).c_str()); + OutputDebugString(fmt::format(L"[msime]: current waited: {}", waited).c_str()); #endif if (PeekNamedPipe(hFromServerPipe, nullptr, 0, nullptr, &bytesAvailable, nullptr) && bytesAvailable > 0) { auto ret = ReadDataFromServerViaNamedPipe(); #ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"PeekNamedPipe: {}", waited).c_str()); + OutputDebugString(fmt::format(L"[msime]: PeekNamedPipe: {}", waited).c_str()); #endif return ret; } @@ -711,7 +711,9 @@ struct FanyImeNamedpipeDataToTsf *ReadDataFromServerViaNamedPipe() else { #ifdef FANY_DEBUG - OutputDebugString(namedpipeDataFromServer.candidate_string); + OutputDebugString(fmt::format(L"[msime]: ReadDataFromServerViaNamedPipe: {}", // + namedpipeDataFromServer.candidate_string) + .c_str()); #endif return &namedpipeDataFromServer; } @@ -753,7 +755,7 @@ void SendToAuxNamedpipe(std::wstring pipeData) } if (!hAuxPipe || hAuxPipe == INVALID_HANDLE_VALUE) { - OutputDebugString(fmt::format(L"SendToAuxNamedpipe: PipeOpenError: {}", pipeData).c_str()); + OutputDebugString(fmt::format(L"[msime]: SendToAuxNamedpipe: PipeOpenError: {}", pipeData).c_str()); return; } DWORD bytesWritten = 0; diff --git a/src/Key/KeyEventSink.cpp b/src/Key/KeyEventSink.cpp index 138119d4..5a3aabe4 100644 --- a/src/Key/KeyEventSink.cpp +++ b/src/Key/KeyEventSink.cpp @@ -474,8 +474,8 @@ STDAPI CMetasequoiaIME::OnKeyUp(ITfContext *pContext, WPARAM wParam, LPARAM lPar *pIsEaten = _IsKeyEaten(pContext, (UINT)wParam, &code, &wch, &KeystrokeState); #ifdef FANY_DEBUG - OutputDebugString(L"fanyfull ITfKeyEventSink::OnKeyUp"); - OutputDebugString(fmt::format(L"Global::PureShiftKeyUp: {}", Global::PureShiftKeyUp).c_str()); + OutputDebugString(L"[msime]: ITfKeyEventSink::OnKeyUp"); + OutputDebugString(fmt::format(L"[msime]: Global::PureShiftKeyUp: {}", Global::PureShiftKeyUp).c_str()); #endif // if (code == VK_SHIFT) diff --git a/src/Key/KeyHandler.cpp b/src/Key/KeyHandler.cpp index 377eb88a..cc004c20 100644 --- a/src/Key/KeyHandler.cpp +++ b/src/Key/KeyHandler.cpp @@ -68,7 +68,7 @@ VOID CMetasequoiaIME::_DeleteCandidateList(BOOL isForce, _In_opt_ ITfContext *pC if (_pCandidateListUIPresenter) { #ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"create_word: dispose window?").c_str()); + OutputDebugString(fmt::format(L"[msime]: create_word: dispose window?").c_str()); #endif _pCandidateListUIPresenter->_EndCandidateList(); @@ -124,7 +124,7 @@ HRESULT CMetasequoiaIME::_HandleToogleIMEMode(TfEditCookie ec, _In_ ITfContext * commitString.assign(keyStrokebuffer.Get(), keyStrokebuffer.GetLength()); CStringRange commitStringRange; commitStringRange.Set(commitString.c_str(), commitString.length()); - OutputDebugString(fmt::format(L"commitString: {}", commitString).c_str()); + OutputDebugString(fmt::format(L"[msime]: commitString: {}", commitString).c_str()); HRESULT hr = _AddCharAndFinalize(ec, pContext, &commitStringRange); if (FAILED(hr)) @@ -203,7 +203,7 @@ HRESULT CMetasequoiaIME::_HandleCompositionInput(TfEditCookie ec, _In_ ITfContex } #ifdef FANY_DEBUG - OutputDebugString(L"Fany AddVirtualKey Here."); + OutputDebugString(L"[msime]: AddVirtualKey Here."); #endif // Add virtual key to composition processor engine pCompositionProcessorEngine->AddVirtualKey(wch); @@ -240,9 +240,9 @@ HRESULT CMetasequoiaIME::_HandleCompositionInputWorker(_In_ CCompositionProcesso { #ifdef FANY_DEBUG // TODO: Log reading strings - OutputDebugString(fmt::format(L"create_word count: {}", readingStrings.Count()).c_str()); + OutputDebugString(fmt::format(L"[msime]: create_word count: {}", readingStrings.Count()).c_str()); std::wstring readingStr = readingStrings.GetAt(0)->ToWString(); - OutputDebugString(fmt::format(L"create_word: {}", readingStr).c_str()); + OutputDebugString(fmt::format(L"[msime]: create_word: {}", readingStr).c_str()); #endif } @@ -250,7 +250,7 @@ HRESULT CMetasequoiaIME::_HandleCompositionInputWorker(_In_ CCompositionProcesso for (UINT index = 0; index < readingStrings.Count(); index++) { #ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"create_word here test!!!").c_str()); + OutputDebugString(fmt::format(L"[msime]: create_word here test!!!").c_str()); #endif CStringRange curReadingStr; std::wstring readingStr = readingStrings.GetAt(0)->ToWString(); diff --git a/src/Key/KeyStateCategory.cpp b/src/Key/KeyStateCategory.cpp index 0320c2b2..eb1c8ca3 100644 --- a/src/Key/KeyStateCategory.cpp +++ b/src/Key/KeyStateCategory.cpp @@ -92,7 +92,7 @@ HRESULT CKeyStateCategory::KeyStateHandler(KEYSTROKE_FUNCTION function, KeyHandl return HandleKeyFinalizeCandidatelist(dto); case FUNCTION_FINALIZE_CANDIDATELISTForVKReturn: #ifdef FANY_DEBUG - OutputDebugString(L"Use VK_RETURN to commit original keystroke string."); + OutputDebugString(L"[msime]: Use VK_RETURN to commit original keystroke string."); #endif return HandleKeyFinalizeCandidatelistForVKReturn(dto); @@ -285,7 +285,7 @@ HRESULT CKeyStateComposing::HandleKeyConvert(KeyHandlerEditSessionDTO dto) if (Global::Keycode == VK_SPACE) { #ifdef FANY_DEBUG - OutputDebugString(L"HandleKeyConvert in CKeyStateComposing\n"); + OutputDebugString(L"[msime]: HandleKeyConvert in CKeyStateComposing\n"); #endif return _pTextService->_HandleCandidateFinalize(dto.ec, dto.pContext); } @@ -345,7 +345,7 @@ HRESULT CKeyStateCandidate::HandleKeyFinalizeCandidatelist(KeyHandlerEditSession HRESULT CKeyStateCandidate::HandleKeyFinalizeCandidatelistForVKReturn(KeyHandlerEditSessionDTO dto) { #ifdef FANY_DEBUG - OutputDebugString(L"Will commit original keystroke string."); + OutputDebugString(L"[msime]: Will commit original keystroke string."); #endif return _pTextService->_HandleCandidateFinalizeForVKReturn(dto.ec, dto.pContext); } @@ -363,7 +363,7 @@ HRESULT CKeyStateCandidate::HandleKeyConvert(KeyHandlerEditSessionDTO dto) if (Global::Keycode == VK_SPACE) { #ifdef FANY_DEBUG - OutputDebugString(L"HandleKeyConvert in CKeyStateCandidate\n"); + OutputDebugString(L"[msime]: HandleKeyConvert in CKeyStateCandidate\n"); #endif return _pTextService->_HandleCandidateFinalize(dto.ec, dto.pContext); } @@ -387,7 +387,7 @@ HRESULT CKeyStateCandidate::HandleKeyArrow(KeyHandlerEditSessionDTO dto) HRESULT CKeyStateCandidate::HandleKeySelectByNumber(KeyHandlerEditSessionDTO dto) { #ifdef FANY_DEBUG - OutputDebugString(L"HandleKeySelectByNumber in CKeyStateCandidate\n"); + OutputDebugString(L"[msime]: HandleKeySelectByNumber in CKeyStateCandidate\n"); #endif // return _pTextService->_HandleCandidateSelectByNumber(dto.ec, dto.pContext, dto.code); return _pTextService->_HandleCandidateFinalize(dto.ec, dto.pContext); @@ -423,7 +423,7 @@ HRESULT CKeyStatePhrase::HandleKeyArrow(KeyHandlerEditSessionDTO dto) HRESULT CKeyStatePhrase::HandleKeySelectByNumber(KeyHandlerEditSessionDTO dto) { #ifdef FANY_DEBUG - OutputDebugString(L"HandleKeySelectByNumber in CKeyStatePhrase\n"); + OutputDebugString(L"[msime]: HandleKeySelectByNumber in CKeyStatePhrase\n"); #endif // return _pTextService->_HandlePhraseSelectByNumber(dto.ec, dto.pContext, dto.code); return _pTextService->_HandleCandidateFinalize(dto.ec, dto.pContext); diff --git a/src/LanguageBar/LanguageBar.cpp b/src/LanguageBar/LanguageBar.cpp index e223e673..9dcd666f 100644 --- a/src/LanguageBar/LanguageBar.cpp +++ b/src/LanguageBar/LanguageBar.cpp @@ -376,9 +376,9 @@ STDAPI CLangBarItemButton::OnClick(TfLBIClick click, POINT pt, _In_ const RECT * { #ifdef FANY_DEBUG OutputDebugString( - fmt::format(L"\nprcArea: ({}, {}, {}, {})\n", prcArea->left, prcArea->top, prcArea->right, prcArea->bottom) + fmt::format(L"[msime]: \nprcArea: ({}, {}, {}, {})\n", prcArea->left, prcArea->top, prcArea->right, prcArea->bottom) .c_str()); - OutputDebugString(L"right click of lang bar item\n"); + OutputDebugString(L"[msime]: right click of lang bar item\n"); #endif SendLangbarRightClickEventToUIProcess(prcArea); return S_OK; diff --git a/src/Thread/ThreadFocusSink.cpp b/src/Thread/ThreadFocusSink.cpp index 7a357b5d..23af0b4d 100644 --- a/src/Thread/ThreadFocusSink.cpp +++ b/src/Thread/ThreadFocusSink.cpp @@ -13,7 +13,7 @@ STDAPI CMetasequoiaIME::OnSetThreadFocus() { - OutputDebugString(fmt::format(L"CMetasequoiaIME::OnSetThreadFocus").c_str()); + OutputDebugString(fmt::format(L"[msime]: CMetasequoiaIME::OnSetThreadFocus").c_str()); PostMessage(_msgWndHandle, WM_ThreadFocus, 0, 0); if (_pCandidateListUIPresenter) { @@ -41,7 +41,7 @@ STDAPI CMetasequoiaIME::OnSetThreadFocus() STDAPI CMetasequoiaIME::OnKillThreadFocus() { - OutputDebugString(fmt::format(L"CMetasequoiaIME::OnKillThreadFocus").c_str()); + OutputDebugString(fmt::format(L"[msime]: CMetasequoiaIME::OnKillThreadFocus").c_str()); if (_pCandidateListUIPresenter) { ITfDocumentMgr *pCandidateListDocumentMgr = nullptr; diff --git a/src/UI/CandidateListUIPresenter.cpp b/src/UI/CandidateListUIPresenter.cpp index 10a071d2..e744a3e8 100644 --- a/src/UI/CandidateListUIPresenter.cpp +++ b/src/UI/CandidateListUIPresenter.cpp @@ -43,7 +43,7 @@ HRESULT CMetasequoiaIME::_HandleCandidateFinalize(TfEditCookie ec, _In_ ITfConte CStringRange candidateString(keyStrokebuffer); #ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"create_word, keystrokeBuffer: {}", keyStrokebuffer.ToWString()).c_str()); + OutputDebugString(fmt::format(L"[msime]: create_word, keystrokeBuffer: {}", keyStrokebuffer.ToWString()).c_str()); #endif // _pCandidateListUIPresenter would be null in uwp/metro apps @@ -63,7 +63,7 @@ HRESULT CMetasequoiaIME::_HandleCandidateFinalize(TfEditCookie ec, _In_ ITfConte { GlobalIme::word_for_creating_word = L""; #ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"create_word, normal???").c_str()); + OutputDebugString(fmt::format(L"[msime]: create_word, normal???").c_str()); #endif candidateString.Set(receivedData->candidate_string, wcslen(receivedData->candidate_string)); hr = _AddComposingAndChar(ec, pContext, &candidateString); @@ -91,7 +91,8 @@ HRESULT CMetasequoiaIME::_HandleCandidateFinalize(TfEditCookie ec, _In_ ITfConte std::wstring curWord = data.substr(data.find(L',') + 1); #ifdef FANY_DEBUG OutputDebugString( - fmt::format(L"create_word, pureFullPinyin: {}, curWord: {}\n", pureFullPinyin, curWord).c_str()); + fmt::format(L"[msime]: create_word, pureFullPinyin: {}, curWord: {}\n", pureFullPinyin, curWord) + .c_str()); #endif GlobalIme::word_for_creating_word = curWord; CCompositionProcessorEngine *pCompositionProcessorEngine = nullptr; @@ -129,7 +130,8 @@ HRESULT CMetasequoiaIME::_HandleCandidateFinalize(TfEditCookie ec, _In_ ITfConte } #ifdef FANY_DEBUG OutputDebugString( - fmt::format(L"create_word: current word part {}\n", GlobalIme::word_for_creating_word).c_str()); + fmt::format(L"[msime]: create_word: current word part {}\n", GlobalIme::word_for_creating_word) + .c_str()); #endif return hr; } @@ -164,7 +166,7 @@ HRESULT CMetasequoiaIME::_HandleCandidateFinalizeForVKReturn(TfEditCookie ec, _I #ifdef FANY_DEBUG std::wstring msg(candidateString.Get(), candidateLen); - OutputDebugString(msg.c_str()); + OutputDebugString(fmt::format(L"[msime]: {}", msg).c_str()); #endif if (candidateLen) @@ -281,11 +283,11 @@ HRESULT CMetasequoiaIME::_HandleCandidateWorker(TfEditCookie ec, _In_ ITfContext pTempCandListUIPresenter->_SetText(&candidatePhraseList, FALSE); #ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"Fany here candidateString = {}", candidateString.Get()).c_str()); + OutputDebugString(fmt::format(L"[msime]: Fany here candidateString = {}", candidateString.Get()).c_str()); #endif #ifdef FANY_DEBUG - OutputDebugString(fmt::format(L"Create word here?").c_str()); + OutputDebugString(fmt::format(L"[msime]: Create word here?").c_str()); #endif // Add composing character @@ -921,7 +923,7 @@ HRESULT CCandidateListUIPresenter::_StartCandidateList(TfClientId tfClientId, _I if (FAILED(hr)) { #ifdef FANY_DEBUG - OutputDebugString(L"MakeCandidateWindow failed\n"); + OutputDebugString(fmt::format(L"[msime]: MakeCandidateWindow failed\n").c_str()); #endif // goto Exit; } @@ -1172,7 +1174,7 @@ void CCandidateListUIPresenter::_MoveWindowToTextExt() VOID CCandidateListUIPresenter::_LayoutChangeNotification(_In_ RECT *lpRect) { - // OutputDebugString(L"LayoutChangeNotification\n"); + // OutputDebugString(fmt::format(L"[msime]: LayoutChangeNotification\n").c_str()); #ifdef FANY_DEBUG // TODO: Log _LayoutChangeNotification firefox cnt: Global::firefox_like_cnt #endif diff --git a/src/Utils/FanyUtils.cpp b/src/Utils/FanyUtils.cpp index ecc7e812..2def971f 100644 --- a/src/Utils/FanyUtils.cpp +++ b/src/Utils/FanyUtils.cpp @@ -32,7 +32,7 @@ void SendKeys(std::wstring pinyin) UINT sent = SendInput(2, in, sizeof(INPUT)); if (sent != 2) { - OutputDebugString(fmt::format(L"SendKeys failed.\n").c_str()); + OutputDebugString(fmt::format(L"[msime]: SendKeys failed.\n").c_str()); } } } diff --git a/src/Window/CandidateWindow.cpp b/src/Window/CandidateWindow.cpp index ac64ba6f..9f678cbe 100644 --- a/src/Window/CandidateWindow.cpp +++ b/src/Window/CandidateWindow.cpp @@ -571,7 +571,7 @@ void CCandidateWindow::_DrawListWithWebview2(_In_ UINT iIndex) DWORD error = GetLastError(); std::wstring errorString = L"FindWindow failed with error: " + std::to_wstring(error); #ifdef FANY_DEBUG - OutputDebugString(errorString.c_str()); + OutputDebugString(fmt::format(L"[msime]: {}", errorString).c_str()); #endif } COPYDATASTRUCT cds; @@ -586,13 +586,14 @@ void CCandidateWindow::_DrawListWithWebview2(_In_ UINT iIndex) { std::wstring errorString = L"SendMessage CandidateWString failed with error: " + std::to_wstring(error); #ifdef FANY_DEBUG - OutputDebugString(errorString.c_str()); + OutputDebugString(fmt::format(L"[msime]: {}", errorString).c_str()); #endif } else { #ifdef FANY_DEBUG - OutputDebugString(L"SendMessage CandidateWString success, but result is 0"); + OutputDebugString( + fmt::format(L"[msime]: SendMessage CandidateWString success, but result is 0").c_str()); #endif } }