From 25ff3e2004a70823cfd2b400bc9375bf4ccfda60 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Mon, 17 Apr 2023 08:50:39 +0200 Subject: [PATCH 1/2] Only initialize imm32 if a text input client is present --- src/Windows/Avalonia.Win32/Input/Imm32InputMethod.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Windows/Avalonia.Win32/Input/Imm32InputMethod.cs b/src/Windows/Avalonia.Win32/Input/Imm32InputMethod.cs index db650db4b0..aabf361844 100644 --- a/src/Windows/Avalonia.Win32/Input/Imm32InputMethod.cs +++ b/src/Windows/Avalonia.Win32/Input/Imm32InputMethod.cs @@ -85,16 +85,18 @@ namespace Avalonia.Win32.Input _parent = parent; - var langId= PRIMARYLANGID(LGID(HKL)); + var langId = PRIMARYLANGID(LGID(HKL)); - if(langId != _langId) + if (IsActive) { - DisableImm(); + if (langId != _langId) + { + DisableImm(); + EnableImm(); + } } _langId = langId; - - EnableImm(); } public void ClearLanguageAndWindow() From a6bc0f9f738ad8431b80fa35c6d04a1e6d2a61d0 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Mon, 17 Apr 2023 08:52:20 +0200 Subject: [PATCH 2/2] [TextLayout] Do not call Draw with current TextLine.Start offset --- src/Avalonia.Base/Media/TextFormatting/TextLayout.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Base/Media/TextFormatting/TextLayout.cs b/src/Avalonia.Base/Media/TextFormatting/TextLayout.cs index a382416b8a..f373e0178a 100644 --- a/src/Avalonia.Base/Media/TextFormatting/TextLayout.cs +++ b/src/Avalonia.Base/Media/TextFormatting/TextLayout.cs @@ -174,7 +174,7 @@ namespace Avalonia.Media.TextFormatting foreach (var textLine in _textLines) { - textLine.Draw(context, new Point(currentX + textLine.Start, currentY)); + textLine.Draw(context, new Point(currentX, currentY)); currentY += textLine.Height; }