From cd0521c8135e6def85f2d52ea90cb09733e57626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=BA=A2=E5=B8=BD?= <761716178@qq.com> Date: Fri, 10 Jan 2025 17:41:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=AA=97=E4=BD=93?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E5=8C=96=E4=B9=8B=E5=90=8E=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E7=AA=97=E4=BD=93=E6=97=A0=E6=B3=95=E8=BE=93=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CPF.Windows/UnmanagedMethods.cs | 2 ++ CPF.Windows/WindowImpl.cs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CPF.Windows/UnmanagedMethods.cs b/CPF.Windows/UnmanagedMethods.cs index a087b14..22d53eb 100644 --- a/CPF.Windows/UnmanagedMethods.cs +++ b/CPF.Windows/UnmanagedMethods.cs @@ -1154,6 +1154,8 @@ BLENDFUNCTION blendFunction // alpha-blending function [DllImport("user32.dll")] public static extern bool SetFocus(IntPtr hWnd); [DllImport("user32.dll")] + public static extern IntPtr GetFocus(); + [DllImport("user32.dll")] public static extern bool SetParent(IntPtr hWnd, IntPtr hWndNewParent); [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, ShowWindowCommand nCmdShow); diff --git a/CPF.Windows/WindowImpl.cs b/CPF.Windows/WindowImpl.cs index eeb31fe..2ba29b1 100644 --- a/CPF.Windows/WindowImpl.cs +++ b/CPF.Windows/WindowImpl.cs @@ -1505,6 +1505,10 @@ namespace CPF.Windows public void SetIMEPosition(Point point) { + if (canActivate && GetFocus() != handle) + { + SetFocus(handle); + } COMPOSITIONFORM cf = new COMPOSITIONFORM(); cf.dwStyle = 2; cf.ptCurrentPos = new POINT((int)(point.X * scaling), (int)(point.Y * scaling)); From 43313828a7ee32da80452581fde8c9df0dfb906d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=BA=A2=E5=B8=BD?= <761716178@qq.com> Date: Fri, 10 Jan 2025 17:44:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3Linux=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=A0=8F=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CPF.Linux/X11Window.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CPF.Linux/X11Window.cs b/CPF.Linux/X11Window.cs index 195c17f..4938b05 100644 --- a/CPF.Linux/X11Window.cs +++ b/CPF.Linux/X11Window.cs @@ -1532,11 +1532,12 @@ namespace CPF.Linux var data = new UIntPtr[_width * _height + 2]; data[0] = new UIntPtr((uint)_width); data[1] = new UIntPtr((uint)_height); + var offset = 2; for (var y = 0; y < _height; y++) { var r = y * _width; for (var x = 0; x < _width; x++) - data[r + x] = new UIntPtr(_bdata[r + x]); + data[r + x + offset] = new UIntPtr(_bdata[r + x]); } fixed (void* pdata = data)