Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuki Hashimoto <hzuika>2021-07-05 14:11:17 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-07-05 18:24:27 +0300
commit83e2f8c993dc8068eb1145e9b8f4756a54f96144 (patch)
tree5d3df9bb8e8f237c4336371f42f9bb2672107141 /intern/ghost/intern/GHOST_WindowCocoa.mm
parentac1ed19eaefe356a1ae2ff3bfb471f940231ce06 (diff)
macOS: support Japanese input for text buttons
Blender did not support to input East Asian characters (Chinese, Japanese, Korean) on macOS. This patch adds support for Japanese input, by implementing the appropriate processing for the NSTextInputClient protocol. Technical notes: * The conversion candidate window is drawn by the input method program calling `firstRectForCharacterRange`. * The string before confirmation (called `composite` in blender) is handled in the `setMarkedText` method called by the input method program. * The string after confirmation (called `result` in the blender) is processed in the `insertText` method called by the input method program. Ref T51283 Differential Revision: https://developer.blender.org/D11695
Diffstat (limited to 'intern/ghost/intern/GHOST_WindowCocoa.mm')
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm23
1 files changed, 23 insertions, 0 deletions
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index d082fa99ad8..cea2969739c 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -1221,3 +1221,26 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
[pool drain];
return GHOST_kSuccess;
}
+
+#ifdef WITH_INPUT_IME
+void GHOST_WindowCocoa::beginIME(
+ GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 w, GHOST_TInt32 h, int completed)
+{
+ if (m_openGLView) {
+ [m_openGLView beginIME:x y:y w:w h:h completed:(bool)completed];
+ }
+ else {
+ [m_metalView beginIME:x y:y w:w h:h completed:(bool)completed];
+ }
+}
+
+void GHOST_WindowCocoa::endIME()
+{
+ if (m_openGLView) {
+ [m_openGLView endIME];
+ }
+ else {
+ [m_metalView endIME];
+ }
+}
+#endif /* WITH_INPUT_IME */