Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@shibukawa
Copy link

Add better IME support (#41) to implement on-the-spot IME conversion. My code is based on #643.

I added the following functions:

  • glfwSetPreeditCallback() : callback function to notify preedit text
  • glfwSetPreeditCursorPos() : teach text cursor position for IME windows
  • glfwGetPreeditCursorPos() : get text cursor position for IME windows

They are not big changes. It keeps backward compatibility about API level.
To use IME feature, UI programmers should implement visualization code for preedit texts.

I implemented platform specific code for Windows/X11/Mac OS X (not Wayland and Mir).

@elmindreda elmindreda self-assigned this Dec 12, 2015
@elmindreda elmindreda added enhancement Feature suggestions and PRs macOS Windows Win32 specific (not Cygwin or WSL) X11 labels Dec 12, 2015
@shibukawa
Copy link
Author

I start implementing my text box, I think some features are needed in addition to the above functions:

  • Set/Get current IME status (integer only text box and so on)
  • IME status change callback (commit text when turn off IME)
  • Reset preedit text (reset text when widget focus would changed)

I will add these functions to my branch.

@elmindreda elmindreda changed the title Better IME support for Windows/X11/Mac OS X Better IME support Dec 13, 2015
@elmindreda
Copy link
Member

My initial impression is that this looks great! I will review it more closely once it's time for the IME part of 3.2, which should hopefully give you time to land the additional features you mention.

@shibukawa shibukawa force-pushed the feature/add-ime-support branch 2 times, most recently from 2c847f3 to 41cd4f7 Compare December 16, 2015 15:21
@shibukawa
Copy link
Author

I implemented all method I mentioned and I added one test application (ime.c, almost as same as event.c, but IME functions are assigned to mouse buttons).

Current status is:

glfw-screenshot

- Windows works almost perfectly except Google Japanese Input doesn't follow cursor position (MS IME works). - Mac OS X's NSTextInputContext doesn't work on my computer (10.9). So resetting preedit text feature doesn't work. - I tested on Ubuntu 15.10, but XIM (X Input Method) implementation is buggy. Test application can receive preedit text and commited text, but my real application can't. I am still debugging.

XIM is very old standard. I think adding Fcitx option (more modern protocol and most popular one now) is better solution (use Fcitx if it is installed, otherwise use XIM). And Fcitx supports Wayland too (I couldn't find Mir information). How about it?

@elmindreda elmindreda modified the milestone: 3.3 Mar 11, 2016
@elmindreda
Copy link
Member

There is quite a range of programming styles in this patch. Did you write this yourself or are parts of it copied from other sources? If so I need to know what licenses they come under.

@elmindreda
Copy link
Member

The glfwGetIMEStatus and glfwSetIMEStatus functions should be folded into glfwGetInputMode and glfwSetInputMode.

@elmindreda
Copy link
Member

The imm32 library should be dynamically loaded the same way as other non-default libraries.

@shibukawa
Copy link
Author

Maybe 50% is my code and 50% is other's. I referred the following Japanese web sites:

Windows: http://www.kumei.ne.jp/c_lang/sdk3/sdk_278.htm
X11: http://homepage3.nifty.com/rio_i/lab/xlib/012xim.htm

I will ask them about sample code's license.

I couldn't find memo about Mac. Of course, I checked MSDN, Apple's document, X11R6 references.

@shibukawa
Copy link
Author

I will merge glfw(Get|Set)IMEStatus into glfw(Get|Set)InputMode.

imm32 is provided as static library by Microsoft and it should be bundled with Windows like gdi32.dll. I thinks if(WIN32) is enough to detect imm32.

@shibukawa shibukawa force-pushed the feature/add-ime-support branch 2 times, most recently from 8d2378f to 66bc5f7 Compare April 6, 2016 15:54
@shibukawa
Copy link
Author

  1. I rebased to fix conflict between current master.
  2. I removed glfw(Get|Set)IMEStatus and added new options to glfw(Get|Set)InputMode
  3. Ryo Ichinose (X11 guy) agreed using XIM related code as libpng/zlib license.

Now I am waiting reply from Yasutaka Kumei.

@shibukawa
Copy link
Author

Yasutaka Kumei agreed using his code with glfw.

@elmindreda
Copy link
Member

Awesome! Thank you!

@elmindreda
Copy link
Member

About the imm32 thing, it's not for compatibility with older systems. As you rightly point out, the import library is available everywhere. Rather it's as a convenience for users, just like the current dynamic loading of winmm.

elmindreda pushed a commit that referenced this pull request Dec 5, 2016
@hesiod
Copy link

hesiod commented Feb 11, 2017

@elmindreda It appears that you wanted to close this PR with 779b562, but Github failed to realize that, so you probably have to close this PR manually

@dmitshur
Copy link
Collaborator

dmitshur commented Feb 12, 2017

It appears that you wanted to close this PR with 779b562, but Github failed to realize that, so you probably have to close this PR manually

@hesiod That commit is not yet merged into master branch. When it is, due to its commit message, this PR will be closed.

@elmindreda
Copy link
Member

What @shurcooL said. Expect several more revisions to pop up here before it's ready to merge, as it's a big and multi-platform addition.

ashie added a commit to clear-code/glfw that referenced this pull request Mar 19, 2024
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Some minor coding style changes are made, but not yet follow glfw's one,
and some comments doesn't follow recent changes. So further work is
needed.

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
ashie added a commit to clear-code/glfw that referenced this pull request Mar 19, 2024
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
ashie added a commit to clear-code/glfw that referenced this pull request Mar 19, 2024
This fix is based on shibukawa's fix:
  glfw#658

The differences is the following.

* Remove `X_HAVE_UTF8_STRING` branching since the current logic doesn't use it
* Replace `XNDestroyCallback` for `XNPreeditAttributes` in `XCreateIC`

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
ashie pushed a commit to clear-code/glfw that referenced this pull request Mar 19, 2024
ashie pushed a commit to clear-code/glfw that referenced this pull request Mar 19, 2024
new

- Daijiro Fukuda
- Ryo Ichinose (from glfw#658)
- Yasutaka Kumei (from glfw#658)
- xfangfang

already in the list

- Takuro Ashie
- Yoshiki Shibukawa
ashie added a commit to clear-code/glfw that referenced this pull request Apr 1, 2024
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Some minor coding style changes are made, but not yet follow glfw's one,
and some comments doesn't follow recent changes. So further work is
needed.

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
ashie added a commit to clear-code/glfw that referenced this pull request Apr 1, 2024
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
ashie added a commit to clear-code/glfw that referenced this pull request Apr 1, 2024
This fix is based on shibukawa's fix:
  glfw#658

The differences is the following.

* Remove `X_HAVE_UTF8_STRING` branching since the current logic doesn't use it
* Replace `XNDestroyCallback` for `XNPreeditAttributes` in `XCreateIC`

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
ashie pushed a commit to clear-code/glfw that referenced this pull request Apr 1, 2024
ashie pushed a commit to clear-code/glfw that referenced this pull request Apr 1, 2024
new

- Daijiro Fukuda
- Ryo Ichinose (from glfw#658)
- Yasutaka Kumei (from glfw#658)
- xfangfang

already in the list

- Takuro Ashie
- Yoshiki Shibukawa
dragonflylee pushed a commit to dragonflylee/glfw that referenced this pull request Jan 3, 2025
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Some minor coding style changes are made, but not yet follow glfw's one,
and some comments doesn't follow recent changes. So further work is
needed.

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
dragonflylee pushed a commit to dragonflylee/glfw that referenced this pull request Jan 3, 2025
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
dragonflylee pushed a commit to dragonflylee/glfw that referenced this pull request Jan 3, 2025
This fix is based on shibukawa's fix:
  glfw#658

The differences is the following.

* Remove `X_HAVE_UTF8_STRING` branching since the current logic doesn't use it
* Replace `XNDestroyCallback` for `XNPreeditAttributes` in `XCreateIC`

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
dragonflylee pushed a commit to dragonflylee/glfw that referenced this pull request Jan 3, 2025
dragonflylee pushed a commit to dragonflylee/glfw that referenced this pull request Jan 3, 2025
new

- Daijiro Fukuda
- Ryo Ichinose (from glfw#658)
- Yasutaka Kumei (from glfw#658)
- xfangfang

already in the list

- Takuro Ashie
- Yoshiki Shibukawa
ashie added a commit to clear-code/glfw that referenced this pull request Jan 14, 2025
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Some minor coding style changes are made, but not yet follow glfw's one,
and some comments doesn't follow recent changes. So further work is
needed.

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
ashie added a commit to clear-code/glfw that referenced this pull request Jan 14, 2025
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
ashie added a commit to clear-code/glfw that referenced this pull request Jan 14, 2025
This fix is based on shibukawa's fix:
  glfw#658

The differences is the following.

* Remove `X_HAVE_UTF8_STRING` branching since the current logic doesn't use it
* Replace `XNDestroyCallback` for `XNPreeditAttributes` in `XCreateIC`

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
ashie pushed a commit to clear-code/glfw that referenced this pull request Jan 14, 2025
ashie pushed a commit to clear-code/glfw that referenced this pull request Jan 14, 2025
new

- Daijiro Fukuda
- Ryo Ichinose (from glfw#658)
- Yasutaka Kumei (from glfw#658)
- xfangfang

already in the list

- Takuro Ashie
- Yoshiki Shibukawa
dougbinks pushed a commit to dougbinks/glfw that referenced this pull request Aug 19, 2025
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Some minor coding style changes are made, but not yet follow glfw's one,
and some comments doesn't follow recent changes. So further work is
needed.

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
dougbinks pushed a commit to dougbinks/glfw that referenced this pull request Aug 19, 2025
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
dougbinks pushed a commit to dougbinks/glfw that referenced this pull request Aug 19, 2025
This fix is based on shibukawa's fix:
  glfw#658

The differences is the following.

* Remove `X_HAVE_UTF8_STRING` branching since the current logic doesn't use it
* Replace `XNDestroyCallback` for `XNPreeditAttributes` in `XCreateIC`

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
dougbinks pushed a commit to dougbinks/glfw that referenced this pull request Aug 19, 2025
dougbinks pushed a commit to dougbinks/glfw that referenced this pull request Aug 19, 2025
new

- Daijiro Fukuda
- Ryo Ichinose (from glfw#658)
- Yasutaka Kumei (from glfw#658)
- xfangfang

already in the list

- Takuro Ashie
- Yoshiki Shibukawa
dougbinks pushed a commit to dougbinks/glfw that referenced this pull request Aug 19, 2025
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Some minor coding style changes are made, but not yet follow glfw's one,
and some comments doesn't follow recent changes. So further work is
needed.

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
dougbinks pushed a commit to dougbinks/glfw that referenced this pull request Aug 19, 2025
This fix is based on shibukawa's fix:
  glfw#658
  shibukawa@d36a164

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
dougbinks pushed a commit to dougbinks/glfw that referenced this pull request Aug 19, 2025
This fix is based on shibukawa's fix:
  glfw#658

The differences is the following.

* Remove `X_HAVE_UTF8_STRING` branching since the current logic doesn't use it
* Replace `XNDestroyCallback` for `XNPreeditAttributes` in `XCreateIC`

Co-authored-by: Yoshiki Shibukawa <[email protected]>
Co-authored-by: Takuro Ashie <[email protected]>
dougbinks pushed a commit to dougbinks/glfw that referenced this pull request Aug 19, 2025
dougbinks pushed a commit to dougbinks/glfw that referenced this pull request Aug 19, 2025
new

- Daijiro Fukuda
- Ryo Ichinose (from glfw#658)
- Yasutaka Kumei (from glfw#658)
- xfangfang

already in the list

- Takuro Ashie
- Yoshiki Shibukawa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature suggestions and PRs macOS Windows Win32 specific (not Cygwin or WSL) X11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants