| Summary: | XIM support doesn't work on Linux | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Alissa_Sabre |
| Component: | events | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P1 | CC: | matsuu, tofu |
| Version: | 1.2.11 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| Bug Depends on: | |||
| Bug Blocks: | 450 | ||
| Attachments: |
Analysis of issues and a proposed patch
A short sample program to disclose the XIM bug. A patch against branches/SDL-1.2@3114 of SVN |
||
|
Description
Alissa_Sabre
2007-05-26 08:02:32 UTC
Created attachment 205 [details] Analysis of issues and a proposed patch This is the content of the http://alissa-sabre.cocolog-nifty.com/files/SDL-IM-20070525.zip Created attachment 206 [details]
A short sample program to disclose the XIM bug.
This is a short sample program to disclose the XIM bug. Repro steps follow. I'm assuming SCIM-Anthy as a sample Input Method, although other famous programs such as kinput2 or UIM can be used to expose the issue.
PREPARATION
- Compile this program as an ordinary SDL application.
- Make sure your Linux system has SCIM and Anthy properly installed and setup.
- Start SCIM if not yet.
- Set two key environment variables to use XIM properly. In this case I used:
LANG=en_us.UTF-8
XMODIFIERS=@im=SCIM
- Start the compiled sample program from xterm with unpatched libSDL.1.2.so.0
- A small SDL window should pops up. Give the winodw the keyboard focus.
- Hit the 'a' key on you keyboard. The sample program should show "0061" which is a hexadecimal Unicode value for 'a'. This is fine.
- Then, hit the SCIM hot key. It depends on the configuration, but Ctrl-Alt-Space, in my case.
OBSERVED BEHAVIOUR
- The sample program echos three "0000"s; one for pressing Ctrl key, one for Alt, and one for Space.
- SCIM status windows does not appear at this moment.
- Typing 'a' key makes the sample program to echo "0061".
EXPECTED BEHAVIOUR
- When you hit the SCIM hot key, the following should happen:
* "0000" is echoed for Ctrl key.
* "0000" is echoed for Alt key.
* Nothing is echoed from the sample program when you hit Space (while holding Ctrl and Alt.) Instead, the SCIM status window should pop up (on the lower right corner of the screen in my case) at this timing.
- Type 'a' key. A _root_preedit_window_ (aka bottom line input area) appears and a hiragana letter A is shown there.
- Type Enter key. The root preedit window disappears and the sample programs echoes "3042" that is the Unicode value for hiragana A.
If you run the sample program with libSDL.1.2.so.0 built with my patch applied, what is described under EXPECTED BEHAVIOUR occurs.
If you use other Input methods, details of the observed and expected behaviour may vary, but the point is, without my patch, you can't use XIM based input methods that require preedits.
Bumping a bunch of bugs to Priority 1 for consideration for the 1.2.12 release. --ryan. I committed this to the 1.2 branch in svn revision #3102. If it works out, we'll keep it in for the 1.2.12 release and merge it to 1.3 thereafter. Please try the latest in Subversion and make sure it still works, since I had to tweak it a little to get it to apply to the latest in revision control. Thanks, --ryan. (Sorry, the correct patch level is svn revision #3103.) --ryan. I grabbed and tried r3103 and r3114 (HEAD as of June 25) from svn (branches/SDL-1.2). XIM support didn't work on both revisions... I'm working on it and report back here. I found a problem. For whatever reason, SDL_x11video.c contains a redundant call to XOpenIM(). Although not clearly documented, a process can't make multiple calls to XOpenIM with a same Display, without closing previous XIM. The redundant call filled SDL_IM a NULL. (The first call is on line 487.) Just removing this redundant call fixes the problem. I'm attaching a patch. Created attachment 216 [details]
A patch against branches/SDL-1.2@3114 of SVN
This is a patch to fix some small (but serious) problem introduced in merging my original patch into SVN. It is against revisioin 3114 of SDL-1.2 branch
(In reply to comment #8) > This is a patch to fix some small (but serious) problem introduced in merging > my original patch into SVN. It is against revisioin 3114 of SDL-1.2 branch Cool, thanks! This patch is now in Subversion, svn revision #3115. Resolving bug... --ryan. |