[This issue was originally reported by shoji@jp.ibm.com at <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=194537>.] When inputting Hangul with scim-hangul it does not work correctly. When there is a preedit string and input focus is changed to another window, the preedit string is committed. But after that, when input focus is moved back to the window, XIM cannot handle first key input. To reproduce: 0. setup scim xim 1. Open gnome-terminal 2. Check XMODIFIERS environment variable $ echo $XMODIFIERS @im=SCIM 3. Start gedit with XIM $ GTK_IM_MODULE=xim gedit 4. Turn on SCIM in gedit window with Ctrl+Space 5. Type "dlf", Korean character is displayed 6. Click desktop window to move window focus 7. Click gedit window to move back focus 8. Type "d", then "d" is displayed <== PROBLEM I have also seen this problem with scim-anthy when inputting Japanese. ----- Additional Comments From shoji@jp.ibm.com 2006-06-19 01:26 EDT ------- This problem is occured when an IM server try to return a preediting string when the current IC is focus out. Please find the following sequence between SCIM and Client (include Xlib). 1. <Client> User hit some keys for preediting. 2. <Client> User operates to focus out from the client application. 3. <Client Xlib> Unregister all KeyPress/KeyRelease filter. 4. <SCIM> Receive IC focus out. 5. <SCIM> Send the current preediting string to <Client> 6. <Client Xlib> Recieve the preediting string as Commited string (CommitRecv). 7. <Client Xlib> PutBack dummy (fabricated) key press event with keycode=0. The current IC is marked FABRICATED. 8. <Client Xlib> _XimProtoMb/WcLookupString is called and obtain the preediting (commited) string. 9. <Client> User operates to focus in to the client application. 10. <Client> User hit a key (KeyPress event). 11. <Client Xlib> The KeyPress event passed to _XimProtoKeyPressFilter. But the IC is still marked FABRICATED, then the filter returns NOTFILTERED. 12. <Clinet Xlib> The KeyPress event is processed as normal (non IM related) key event, then the client displays alphabet character. The fundamental issue is when we should turne off the FABRICATED flag of the IC, if IC unset the focus. Usually, _XimProtoKeypress/KeyreleaseFilter turns off the FABRICATED flag. It works fine when IC has the focus and those filters are registered. But when unset the IC focus, then those filters are unregistered and no longer called until the IC has the focus again. So, the IC still has FABLICATED flag when the next key press is occured. My idea is that the FABLICATED flag is used for handling committed string. So, the flag must be turned off when the committed string handle is over. The original code calls _XimUnregCommitInfo() when the handling is over. Therefore, I added to turn off the FABLICATED flag in there If you have any other sophisticated solutions, it would be welcome. ----- Additional Comments From shoji@jp.ibm.com 2006-06-20 19:46 EDT ------- I checked the fix with the following other IMs through XIM protocol. o kinput2 + canna o xcin o Ami o skkinput o uim-anthy I used "xterm" and "gtk-demo" for the test. I checked regualar text input with IM and set/unset IC operation during preediting. All of them works OK. None of them returns "preediting" string when IC unset focus. So, regular text input is a primary checkpoint.
Created attachment 6734 [details] [review] libX11-LTC24382.patch Patch by shoji@jp.ibm.com which fixes problem.
Sorry about the phenomenal bug spam, guys. Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Can you please send your patch to xorg-devel for review?
Mass closure: This bug has been untouched for more than six years, and is not obviously still valid. Please reopen this bug or file a new report if you continue to experience issues with current releases.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.