| Summary: | Add IBus IME support | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Alex Baines <alex> |
| Component: | *don't know* | Assignee: | Alex Baines <alex> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | CC: | philipp.wiesemann |
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: |
IBus Patch
IBus Patch v2 IBus Patch v3 IBus Patch v3.1 IBus Patch v3.2 IBus Patch v3.3 |
||
In SDL_dbus.c a plain memset() and in SDL_ibus.c a plain strdup() is used. I do not know if it matters here but in the other files it is SDL_memset() and SDL_strdup(). Created attachment 1657 [details]
IBus Patch v2
Thanks, I have updated the patch changing these functions to the proper SDL_ versions.
I also fixed a few other bugs:
- removed some defines from SDL_config.h.in that were from an older patch and were no longer needed.
- corrected the style of some pointer definitions from "type* name" to "type *name"
- Added SDL_IBus_Reset and call it when text input is disabled to close and reset the candidate list (before it would just stick around forever if you disabled text input while it was open).
There are a few issues with the current patch that I've noticed, namely: - If it couldn't connect to IBus initially, it will try fopening() the ibus address file every time a key is pressed while the SDL_TEXTINPUT event is enabled. It should probably use inotify for this instead. - The SDL_TEXTEDITING events only have 32 bytes of room for editing text, but IBus has no such limit, I'm not sure how to handle the case where IBus is editing >32 bytes of text. Can you fix this issue before we accept the patch? "If it couldn't connect to IBus initially, it will try fopening() the ibus address file every time a key is pressed while the SDL_TEXTINPUT event is enabled. It should probably use inotify for this instead." Thanks! Created attachment 1683 [details]
IBus Patch v3
Ok, Here's an updated patch that uses inotify and sends multiple editing events in a row if IBus has >32 chars being edited.
Created attachment 1684 [details]
IBus Patch v3.1
Just made a small update to the latest patch to fix some formatting and remove a call to non-SDL strlen.
Created attachment 1686 [details]
IBus Patch v3.2
Here is another new version of the patch. It fixes a single-character typo in configure.in and adds a patch by Weitian Leung to stop key events being sent if they were handled by IBus.
Created attachment 1690 [details]
IBus Patch v3.3
Sorry, here's yet another version of the patch, hopefully the last. This corrects Key events not being sent when compiled with --disable-ibus.
Looks good, thanks! https://hg.libsdl.org/SDL/rev/26a6243b27c2 Feel free to submit new bugs with any additional patches. |
Created attachment 1654 [details] IBus Patch This patch adds support for the IBus IME to SDL on X11/Linux platforms. It uses DBus directly to interact with IBus instead of linking with / loading all the glib related stuff that libibus needs. The existing DBus code was also moved to its own file to better support this.