Enhance support for IME (Input Method Editor) in Windows

Hello everyone, I have noticed that Blender has support for IME (Input Method Editor) in the Windows platform, but there are still many issues.

I have attempted to improve Blender’s support for IME in Windows and have already completed the modifications.

Note: Just for Windows. I am not familiar with Linux and macOS.

ime-aware-in-windows-dev

This branch is only for development purposes. It will output debugging information on the console.

The following video provides a quick preview of the comparison before and after modifications:

It can solve these problems:
#84081, #89831, 93421, #96696, #112119, #122469

I am not a proficient C & C++ developer, so the code style may not be good.

But I am preparing to start a Pull Request, but I have some questions that I would like to consult.

  1. This modification involves three potentially significant changes:

    a. After the IME is enabled, key messages will be processed in WM_KEYDOWN instead of WM_INPUT.

    To support IME, it is necessary to know whether a key has been processed by the IME. This information can only be obtained through WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, WM_SYSKEYUP, not WM_INPUT.

    At present, Blender only handles WM_INPUT and ignores WM_KEYDOWN, resulting in various issues when using IME.

    What I want to ask is, is there any special reason why Blender ignores WM_KEYDOWN?

    b. GHOST_ImeWin32 is changed so much

    This class comes from an old version of Chromium, which is outdated. To solve the current problem, it needs to be adjusted.

    I personally think that the modifications made to it are not very significant, only removing some useless features and improving some functions.

    But I’m not sure if this can be considered a major change from the perspective of Blender developers.

    c. A new callback function has been added to ARegionType.

    Because it is necessary to track changes in region focus to enable or disable IME in real time, a callback function on_activation_changed has been added to ARegionType.

    When the focus changes (ED_screen_set_active_region), the region will receive a notification.

    Does this design conform to Blender’s design?

  2. Should I split this modification into multiple pull request?

    Partial modifications can be separated, but they are all centered around the IME. Should I split them into multiple pull requests or just a single one?

12 Likes

Thanks for working on this. It certainly looks like wonderful changes and improvements!

I think the very first step would be to just submit a single big PR with all the changes in whatever state it is in, and don’t worry about things like code style or Blender design. Having that would allow some of us examine the code in detail to help plan for changes, review, and approval. Later it might end up split into multiple pieces, but nice to start by seeing the big picture. And that would also allow us to better answer the questions you have posed here as well.

2 Likes

Okay, I’ll organize the code and submit the PR.

2 Likes