From d89905fc3d066cb9e1cf10d70e31b731fdc31cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=99=BD?= <364772080@qq.com> Date: Fri, 22 Mar 2024 00:31:43 +0800 Subject: [PATCH] Fix `IME` window position with scale factor greater than 1.0 (#9637) In #9456 I forgot to handle this... Release Notes: - N/A --- crates/gpui/src/platform/windows/window.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index 94c3c68cf7..698149ddb1 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -689,11 +689,14 @@ impl WindowsWindowInner { let caret_range = input_handler.selected_text_range().unwrap(); let caret_position = input_handler.bounds_for_range(caret_range).unwrap(); self.input_handler.set(Some(input_handler)); + let scale_factor = self.scale_factor.get(); let config = CANDIDATEFORM { dwStyle: CFS_CANDIDATEPOS, + // logical to physical ptCurrentPos: POINT { - x: caret_position.origin.x.0 as i32, - y: caret_position.origin.y.0 as i32 + (caret_position.size.height.0 as i32 / 2), + x: (caret_position.origin.x.0 * scale_factor) as i32, + y: (caret_position.origin.y.0 * scale_factor) as i32 + + ((caret_position.size.height.0 * scale_factor) as i32 / 2), }, ..Default::default() };