diff --git a/src/IME/MetasequoiaIME.cpp b/src/IME/MetasequoiaIME.cpp index c92121a1..f442d36d 100644 --- a/src/IME/MetasequoiaIME.cpp +++ b/src/IME/MetasequoiaIME.cpp @@ -2399,6 +2399,10 @@ LRESULT CALLBACK CMetasequoiaIME_WindowProc(HWND hWnd, UINT message, WPARAM wPar break; } case WM_ThreadFocus: { + // Some Chromium/Electron window switches surface only as thread-focus + // changes. Refresh this thread's cached TSF language-bar item even when + // there was no document-focus transition. + pIME->_RefreshLanguageBarThemeIcons(); SendCurrentImeStatusSnapshot(pIME); break; } diff --git a/src/LanguageBar/LanguageBar.cpp b/src/LanguageBar/LanguageBar.cpp index 559ae070..3709b04f 100644 --- a/src/LanguageBar/LanguageBar.cpp +++ b/src/LanguageBar/LanguageBar.cpp @@ -109,7 +109,19 @@ void CMetasequoiaIME::_UpdateLanguageBarOnSetFocus(_In_ ITfDocumentMgr *pDocMgrF CCompositionProcessorEngine *pCompositionProcessorEngine = nullptr; pCompositionProcessorEngine = _pCompositionProcessorEngine; - pCompositionProcessorEngine->SetLanguageBarStatus(TF_LBI_STATUS_DISABLED, needDisableButtons); + pCompositionProcessorEngine->SetLanguageBarStatus(TF_LBI_STATUS_DISABLED, needDisableButtons); + + // SetStatus intentionally keeps the item enabled when focus is absent so + // Firefox does not replace our mode glyph with its disabled/close glyph. + // Consequently, returning to a document may not change the status bits and + // therefore may not generate an ITfLangBarItemSink update. Always refresh + // the newly focused thread's item: Windows caches each host/thread's icon, + // and another host may have changed the shared Chinese/Japanese mode while + // this one was in the background. + if (!needDisableButtons) + { + pCompositionProcessorEngine->RefreshLanguageBarIcons(); + } } //+---------------------------------------------------------------------------