Skip to content

Commit

Permalink
IME: enable/disable in text object
Browse files Browse the repository at this point in the history
  • Loading branch information
hzuika committed Aug 5, 2021
1 parent ca64bd0 commit 94ce267
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/blender/editors/object/CMakeLists.txt
Expand Up @@ -92,4 +92,10 @@ if(WITH_EXPERIMENTAL_FEATURES)
add_definitions(-DWITH_HAIR_NODES)
endif()

if(WIN32 OR APPLE)
if(WITH_INPUT_IME)
add_definitions(-DWITH_INPUT_IME)
endif()
endif()

blender_add_lib(bf_editor_object "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
23 changes: 23 additions & 0 deletions source/blender/editors/object/object_edit.c
Expand Up @@ -117,6 +117,11 @@

#include "object_intern.h" /* own include */

#ifdef WITH_INPUT_IME
#include "wm_window.h"
#include "BLT_lang.h"
#endif

static CLG_LogRef LOG = {"ed.object.edit"};

/* prototypes */
Expand Down Expand Up @@ -892,6 +897,14 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op)
}
FOREACH_SELECTED_OBJECT_END;
}

#ifdef WITH_INPUT_IME
if (obact->type == OB_FONT && BLT_lang_is_ime_supported()) {
wmWindow *win = CTX_wm_window(C);
wm_window_IME_begin(win, 0, 0, 0, 0, true);
}
#endif

}
else {
ED_object_editmode_exit_ex(bmain, scene, obact, EM_FREEDATA);
Expand All @@ -904,6 +917,16 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op)
}
FOREACH_OBJECT_END;
}

#ifdef WITH_INPUT_IME
if (obact->type == OB_FONT) {
wmWindow *win = CTX_wm_window(C);
if (win->ime_data) {
wm_window_IME_end(win);
}
}
#endif

}

WM_msg_publish_rna_prop(mbus, &obact->id, obact, Object, mode);
Expand Down

0 comments on commit 94ce267

Please sign in to comment.