Fix the issue where the language bar and FTB are out of sync for the Chinese-Japanese status.

This commit is contained in:
fanlusky committed 2026-08-22 19:40:33 +08:00
1 parent 93319ec711
commit ffe90560cd
2 files changed
+17 -1

No files matched your search

+4
View File
@@ -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;
}
+13 -1
View File
@@ -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();
}
}
//+---------------------------------------------------------------------------