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
This commit is contained in:
Yuki Hashimoto
2021-07-05 13:14:32 +02:00
committed by Brecht Van Lommel
parent 32124b940e
commit 2d0b9faaf6

View File

@@ -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);
}