[SDL] X11 unicode input...

Mohammed Yousif mhdyousif at gmx.net
Sun Nov 20 11:36:10 PST 2005

On Friday 18 November 2005 03:22, Ryan C. Gordon wrote:
> A while ago someone posted a patch for Unicode input in the X11 driver:
>      http://lists.arabeyes.org/archives/developer/2004/June/msg00160.html
> I've cleaned it up to work with SDL CVS, but it fails to fill in the
> "unicode" field for key release events (as the documentation for
> Xutf8LookupString() says it will), so I can't commit the patch, since
> that's technically a downgrade from what SDL currently does.

Maybe the reason Xutf8LookupString() has undefined behavior when passing key 
release events is that the unicode value has no meaning in this context.

I think, and please correct me if I'm wrong, that SDL doesn't fill the unicode 
field anyway for key release events because of the above reason and thus the 
patch cannot really be considered a downgrade.

This has been discussed before in this thread:

> If someone can fix this somehow, I'll commit it to CVS, otherwise, the
> updated patch is attached for those that have a personal need for it.

Thanks for taking the time.

Anyway since the manual says that Xutf8LookupString() has undefined behavior 
when passing KeyRelease events, I modified this updated patch to check the 
type of the event before calling Xutf8LookupString() by replacing the line in  
the X11_TranslateKey function that reads:
if (ic == NULL) {

if (ic == NULL || xkey->type != KeyPress) {

Thanks again :-)

Mohammed Yousif

"قال قائل منهم إني كان لي قرين. يقول أءنك لمن المصدقين. أءذا متنا وكنا تراباً 
وعظاماً أءنا لمدينون. قال هل أنتم مطلعون. فاطلع فرءاه في سواء الجحيم. قال
تالله إن كدت لتردين. ولولا نعمة ربي لكنت من المحضرين"  (من القرءان الكريم)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SDL-x11-utf8-keys.txt.zip
Type: application/x-zip
Size: 5298 bytes
Desc: not available
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20051120/82c467ea/attachment-0008.bin>

More information about the SDL mailing list