Skip to content

Commit

Permalink
ImeMode.NoControl in Text and Combo boxes on CHS pinyin was swi… (#1975)
Browse files Browse the repository at this point in the history
ImeMode.NoControl in Text and Combo boxes on CHS pinyin was switching to ENG
  • Loading branch information
RussKie committed Oct 2, 2019
2 parents 1852a20 + 4c3b2b9 commit be3d339
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 deletions.
5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/System/Windows/Forms/ComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,11 @@ private void ChildWndProc(ref Message m)
// once in the combobox and once here.
if (fireSetFocus)
{
if (!DesignMode && childEdit != null && m.HWnd == childEdit.Handle)
{
WmImeSetFocus();
}

InvokeGotFocus(this, EventArgs.Empty);
}

Expand Down
30 changes: 1 addition & 29 deletions src/System.Windows.Forms/src/System/Windows/Forms/Control.Ime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ public partial class Control :
/// </summary>
private static bool ignoreWmImeNotify;

/// <summary>
/// This flag works around an Issue with the Chinese IME sending IMENotify messages prior to WmInputLangChange
/// which would cause this code to use OnHalf as the default mode overriding .ImeMode property. See WmImeNotify
/// </summary>
private static bool lastLanguageChinese = false;

/// <summary>
/// The ImeMode in the property store.
/// </summary>
Expand Down Expand Up @@ -711,11 +705,6 @@ private void WmInputLangChange(ref Message m)
PropagatingImeMode = ImeMode.Off;
}

if (ImeModeConversion.InputLanguageTable == ImeModeConversion.ChineseTable)
{
IgnoreWmImeNotify = false;
}

Form form = FindForm();

if (form != null)
Expand Down Expand Up @@ -787,24 +776,7 @@ private void WmImeEndComposition(ref Message m)
/// </summary>
private void WmImeNotify(ref Message m)
{
ImeMode[] inputLanguageTable = ImeModeConversion.InputLanguageTable;

// During a change to the Chinese language with Focus already set, the Chinese IME will send several WmImeNotify messages
// before ever sending a WmInputLangChange event. Also, the IME will report an IME input context during this time that we
// interpret as On = 'OnHalf'. The combination of these causes us to update the default Cached ImeMode to OnHalf, overriding
// the control's ImeMode property -- unwanted behavior. We workaround this by skipping our mode synchronization during these
// IMENotify messages until we get a WmInputLangChange event.
//
// If this is the first time here after conversion to chinese language, wait for WmInputLanguageChange
// before listening to WmImeNotifys.
if ((inputLanguageTable == ImeModeConversion.ChineseTable) && !lastLanguageChinese)
{
IgnoreWmImeNotify = true;
}

lastLanguageChinese = (inputLanguageTable == ImeModeConversion.ChineseTable);

if (ImeSupported && inputLanguageTable != ImeModeConversion.UnsupportedTable && !IgnoreWmImeNotify)
if (ImeSupported && ImeModeConversion.InputLanguageTable != ImeModeConversion.UnsupportedTable && !IgnoreWmImeNotify)
{
int wparam = (int)m.WParam;

Expand Down

0 comments on commit be3d339

Please sign in to comment.