Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added IME support for OSX examples #2598

Closed
wants to merge 1 commit into from

Conversation

actboy168
Copy link
Contributor

This patch adds IME support for macOS and also fixes some input bugs, such as #2578.

Some TODO:

  1. The osx/opengl example has been unusable, I can't test it and add IME support.
  2. On macOS, ImGui needs to render Editing Text by itself. But this is not very important.
  3. Since there is no Editing Text, the IME cannot cover the cursor. That is to say, g.FontSize cannot be subtracted here.
    g.PlatformImePos = ImVec2(cursor_screen_pos.x - 1.0f, cursor_screen_pos.y - g.FontSize);

@ocornut
Copy link
Owner

ocornut commented May 31, 2019

Thank you!
Some quick feedback:

  • please keep the code in the same source file.
  • could you later provide GIF of how this is working/behaving?

Some thoughts:

  • as with clipboard, I don't rule out including this code directly in imgui.cpp to simplify integration for new users of all backends. But I don't know if it is possible without Obj-C code.
  • we will later need to consider how this would work for multi-viewports (although that's not supported by imgui_impl_osx.mm at the moment only by SDL/GLFW back-ends).

@actboy168
Copy link
Contributor Author

May-31-2019 18-06-56

Because the font of the default example does not support Chinese, I used another example, but they are the same.

@actboy168
Copy link
Contributor Author

Unlike windows, macOS needs to implement NSTextInputClient in the content view. So there is no way to implement it simply in the callback function.

@actboy168
Copy link
Contributor Author

The reason I didn't put the code into the existing file is that I want to share the code between the metal and opengl examples. Although opengl is not supported now.

@ocornut
Copy link
Owner

ocornut commented Jan 12, 2022

Hello @actboy168,
While processing PR/issues I have now merged #3108 (commit 457d4b7)
I admit when I did so I forgot about this other PR here. #3108 looks simpler, but do you think there are features that this PR handles that #3108 did not? Trying to understand if we are missing something or if this is fully solved.
Thank you!

@ocornut ocornut force-pushed the master branch 2 times, most recently from b3b85d8 to 0755767 Compare January 17, 2022 14:21
@actboy168
Copy link
Contributor Author

I think it's working fine now.

@ocornut ocornut closed this Jan 20, 2022
ocornut added a commit that referenced this pull request Jan 15, 2024
…87, favor of writing to 'void* ImGuiViewport::PlatformHandleRaw'.

Amend 3a90dc3 (#2589, #2598, #3108, #3113, #3653, #4642)
@actboy168 actboy168 deleted the patch-2 branch January 23, 2024 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants