Remove TF_TMAE_UIELEMENTENABLEDONLY (#19738)

Closes #19670
Closes #19722
This commit is contained in:
Leonard Hecker 2026-01-13 20:59:59 +01:00 committed by GitHub
parent 7f91e94f1a
commit 58f1f3b312
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,8 +38,6 @@ using unique_tf_propertyval = wil::unique_struct<TF_PROPERTYVAL, decltype(&TfPro
// --------
//
// In any case, we pass the same flags as conhost v1:
// - TF_TMAE_UIELEMENTENABLEDONLY: TSF activates only text services that are
// categorized in GUID_TFCAT_TIPCAP_UIELEMENTENABLED.
// - TF_TMAE_NOACTIVATEKEYBOARDLAYOUT: TSF does not sync the current keyboard layout
// while this method is called. The keyboard layout will be adjusted when the
// calling thread gets focus. This flag must be used with TF_TMAE_NOACTIVATETIP.
@ -48,7 +46,12 @@ using unique_tf_propertyval = wil::unique_struct<TF_PROPERTYVAL, decltype(&TfPro
// from this, because Korean relies on "recomposing" previously finished compositions.
// That can't work in a terminal, since we submit composed text to the shell immediately.
//
// I'm not sure what TF_TMAE_UIELEMENTENABLEDONLY does. I tried to figure it out but failed.
// ...with the exception of, for the following reason:
// - TF_TMAE_UIELEMENTENABLEDONLY: This flag tells TSF that the caller wants to render its
// own candidate "window". The required interface for that is `UIElement` and so it only works
// with TIPs (Text Input Panel) that flag themselves as `GUID_TFCAT_TIPCAP_UIELEMENTENABLED`.
// We don't support an "UILess" mode (= don't render our own TIP) and so we should not set this flag.
// See: https://learn.microsoft.com/en-us/windows/win32/tsf/uiless-mode-overview
//
// For TF_TMAE_NOACTIVATEKEYBOARDLAYOUT, I'm 99% sure it doesn't do anything, including in
// conhost v1. This is because IMM will be initialized on WM_ACTIVATE, which calls ActivateEx(0).
@ -56,7 +59,7 @@ using unique_tf_propertyval = wil::unique_struct<TF_PROPERTYVAL, decltype(&TfPro
// TF_TMAE_NOACTIVATETIP which are explicitly filtered out.
//
// TF_TMAE_NOACTIVATETIP however is important. Without it, TIPs are immediately initialized.
static std::atomic<DWORD> s_activationFlags{ TF_TMAE_NOACTIVATETIP | TF_TMAE_UIELEMENTENABLEDONLY | TF_TMAE_NOACTIVATEKEYBOARDLAYOUT | TF_TMAE_CONSOLE };
static std::atomic<DWORD> s_activationFlags{ TF_TMAE_NOACTIVATETIP | TF_TMAE_NOACTIVATEKEYBOARDLAYOUT | TF_TMAE_CONSOLE };
void Implementation::AvoidBuggyTSFConsoleFlags() noexcept
{
s_activationFlags.fetch_and(~static_cast<DWORD>(TF_TMAE_CONSOLE), std::memory_order_relaxed);