Skip to content

Commit

Permalink
Set _ignoreWmChar when IME sends a ImeProcessed key to prevent input …
Browse files Browse the repository at this point in the history
…via WM_CHAR (#12942)
  • Loading branch information
Gillibald authored and grokys committed Oct 2, 2023
1 parent 2d45ed8 commit 1b856c8
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -775,12 +775,19 @@ protected virtual unsafe IntPtr AppWndProc(IntPtr hWnd, uint msg, IntPtr wParam,

if (message == WindowsMessage.WM_KEYDOWN)
{
// Handling a WM_KEYDOWN message should cause the subsequent WM_CHAR message to
// be ignored. This should be safe to do as WM_CHAR should only be produced in
// response to the call to TranslateMessage/DispatchMessage after a WM_KEYDOWN
// is handled.
_ignoreWmChar = e.Handled;
}
if(e is RawKeyEventArgs args && args.Key == Key.ImeProcessed)
{
_ignoreWmChar = true;
}
else
{
// Handling a WM_KEYDOWN message should cause the subsequent WM_CHAR message to
// be ignored. This should be safe to do as WM_CHAR should only be produced in
// response to the call to TranslateMessage/DispatchMessage after a WM_KEYDOWN
// is handled.
_ignoreWmChar = e.Handled;
}
}

if (s_intermediatePointsPooledList.Count > 0)
{
Expand Down

0 comments on commit 1b856c8

Please sign in to comment.