diff options
author | Yuki Hashimoto <hzuika> | 2021-07-05 14:11:17 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-07-05 18:24:27 +0300 |
commit | 83e2f8c993dc8068eb1145e9b8f4756a54f96144 (patch) | |
tree | 5d3df9bb8e8f237c4336371f42f9bb2672107141 /source | |
parent | ac1ed19eaefe356a1ae2ff3bfb471f940231ce06 (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 'source')
-rw-r--r-- | source/blender/blentranslation/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blentranslation/CMakeLists.txt b/source/blender/blentranslation/CMakeLists.txt index 70e68ca06d7..bfb812ac64d 100644 --- a/source/blender/blentranslation/CMakeLists.txt +++ b/source/blender/blentranslation/CMakeLists.txt @@ -59,7 +59,7 @@ if(WITH_PYTHON) ) endif() -if(WIN32) +if(WIN32 OR APPLE) if(WITH_INPUT_IME) add_definitions(-DWITH_INPUT_IME) endif() diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index 5011a50ed73..2cc3830042c 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -102,7 +102,7 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -if(WIN32) +if(WIN32 OR APPLE) if(WITH_INPUT_IME) add_definitions(-DWITH_INPUT_IME) endif() diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index cb5c62e4507..94e89944f08 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -217,8 +217,8 @@ enum { #define WM_KEYCONFIG_STR_DEFAULT "Blender" -/* IME is win32 only! */ -#if !defined(WIN32) && !defined(DNA_DEPRECATED) +/* IME is win32 and apple only! */ +#if !(defined(WIN32) || defined(__APPLE__)) && !defined(DNA_DEPRECATED) # ifdef __GNUC__ # define ime_data ime_data __attribute__((deprecated)) # endif @@ -302,7 +302,7 @@ typedef struct wmWindow { struct wmGesture *tweak; /* Input Method Editor data - complex character input (especially for Asian character input) - * Currently WIN32, runtime-only data. */ + * Currently WIN32 and APPLE, runtime-only data. */ struct wmIMEData *ime_data; /** All events #wmEvent (ghost level events were handled). */ diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 183b22c9791..e513c49c11b 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -181,7 +181,7 @@ if(WITH_INPUT_NDOF) add_definitions(-DWITH_INPUT_NDOF) endif() -if(WIN32) +if(WIN32 OR APPLE) if(WITH_INPUT_IME) add_definitions(-DWITH_INPUT_IME) endif() diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index d59ebabc643..9657f8aa03c 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -168,7 +168,7 @@ static void window_manager_blend_read_data(BlendDataReader *reader, ID *id) win->eventstate = NULL; win->cursor_keymap_status = NULL; win->tweak = NULL; -#ifdef WIN32 +#if defined(WIN32) || defined(__APPLE__) win->ime_data = NULL; #endif |