[Bf-blender-cvs] [2d0b9faaf6e] master: Fix: IME conversion candidate window not correctly placed on macOS

Yuki Hashimoto noreply at git.blender.org
Mon Jul 5 14:32:41 CEST 2021


Commit: 2d0b9faaf6ec63e6d782c09f6ebb4758737d7b8f
Author: Yuki Hashimoto
Date:   Mon Jul 5 13:14:32 2021 +0200
Branches: master
https://developer.blender.org/rB2d0b9faaf6ec63e6d782c09f6ebb4758737d7b8f

Fix: IME conversion candidate window not correctly placed on macOS

Blender needs to tell the input method program where the conversion
candidate window is during Japanese and Chinese input.

In macOS, there are displays where the window size and the native pixel size
are different, so the candidate window may appear in an unnatural position.

This patch converts the cursor position x and y for matching macOS window
coordinate. On Windows, GHOST_GetNativePixelSize returns 1, so it has no effect.

Differential Revision: https://developer.blender.org/D11696

===================================================================

M	source/blender/windowmanager/intern/wm_window.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index b61975e1b1a..954976fddb6 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -2403,6 +2403,10 @@ void wm_window_IME_begin(wmWindow *win, int x, int y, int w, int h, bool complet
 {
   BLI_assert(win);
 
+  /* Convert to native OS window coordinates. */
+  float fac = GHOST_GetNativePixelSize(win->ghostwin);
+  x /= fac;
+  y /= fac;
   GHOST_BeginIME(win->ghostwin, x, win->sizey - y, w, h, complete);
 }



More information about the Bf-blender-cvs mailing list