Unicode input on X11
Hi there,
I was playing tonight and noticed someone talking Russian. So I figured Cyrillic works under Windows, but it didn't under Linux.
Well, after 5 hours, now it does – at least for me.
Here is the patch:
http://virtuall.info/files/ucs.patch
You'll also need to put these files into the "unix" directory:
http://www.cl.cam.ac.uk/~mgk25.....ysym2ucs.c
http://www.cl.cam.ac.uk/~mgk25.....ysym2ucs.h
And yes, you can also play and talk without switching the charset. You can't type ё, however, for known reasons.
It doesn't, however, work with Latvian accented characters (using Alt). Not sure why yet.
Sorry if wrote something stupid, never worked with X11 directly before.
Could anyone please test this under other *nix-es or with other languages?
—————
UPD: I have no idea why authors haven't included this in 0.6. The patch still applies perfectly, except the Makefile, and I've been using it on 0.5 without any problems for a year now. But since people have had difficulties applying it, here is ready to use patched 0.6:
- patched x86_64 binary
- patched i386 binary (untested, could someone verify?)
- Other platforms: All patched + new files – unpack this and overwrite files in the SDK.
I was playing tonight and noticed someone talking Russian. So I figured Cyrillic works under Windows, but it didn't under Linux.
Well, after 5 hours, now it does – at least for me.
Here is the patch:
http://virtuall.info/files/ucs.patch
You'll also need to put these files into the "unix" directory:
http://www.cl.cam.ac.uk/~mgk25.....ysym2ucs.c
http://www.cl.cam.ac.uk/~mgk25.....ysym2ucs.h
And yes, you can also play and talk without switching the charset. You can't type ё, however, for known reasons.
It doesn't, however, work with Latvian accented characters (using Alt). Not sure why yet.
Sorry if wrote something stupid, never worked with X11 directly before.
Could anyone please test this under other *nix-es or with other languages?
—————
UPD: I have no idea why authors haven't included this in 0.6. The patch still applies perfectly, except the Makefile, and I've been using it on 0.5 without any problems for a year now. But since people have had difficulties applying it, here is ready to use patched 0.6:
- patched x86_64 binary
- patched i386 binary (untested, could someone verify?)
- Other platforms: All patched + new files – unpack this and overwrite files in the SDK.
while( *p )
{
// the delete character is an ASCII code 127 (HACK!)
+ qwchar *wp = (qwchar *)p;
if( *p != 127 )
- Key_CharEvent( key, *p );
+ Key_CharEvent( key, *wp );
p++;
}
This code block looks suspicious to me
Hm. Now that you pointed that out, it looks suspicious to me too.
Actually, it looks pretty stupid. Wonder why I did that. o_O
UPD. Ok, I understood what I meant by that.
UPD2: This is how it should be:
UPD. Ok, I understood what I meant by that.
UPD2: This is how it should be:
@@ -580,7 +605,7 @@ static void HandleEvents( void )
qboolean dowarp = qfalse;
int mwx = x11display.win_width / 2;
int mwy = x11display.win_height / 2;
- unsigned char *p;
+ qwchar *p;
int key = 0;
int time = 0;
@@ -620,7 +645,7 @@ static void HandleEvents( void )
{
case KeyPress:
time = Sys_XTimeToSysTime(event.xkey.time);
- p = (unsigned char *)XLateKey( &event.xkey, &key );
+ p = (qwchar *)XLateKey( &event.xkey, &key );
if( key >= 0 && key
BTW is there really a case when XLookupString can return multiple
ASCII characters? Since in that case my code would break
everything.
Afaiu, it is only possible with XRebindKeysym, which is not used. Why 64 bytes then?
Afaiu, it is only possible with XRebindKeysym, which is not used. Why 64 bytes then?
http://tronche.com/gui/x/xlib/utilities ...
tring.html
XLookupString() returns the number of characters that are stored in the buffer.
If the KeySym has been rebound (see XRebindKeysym()), the bound string will be stored in the buffer. Otherwise, the KeySym is mapped, if possible, to an ISO Latin-1 character or (if the Control modifier is on) to an ASCII control character, and that character is stored in the buffer.
So basically in this case it always returns 1 (or 0). Or rebinding keysyms is possible from outside? An X expert is needed :/
Also remember we're talking just chat here. The keys pressed are
still determined by keysym or first byte of buf. So even if I got
something *seriously* wrong, it couldn't cause any major problems.
Since I just told someone about the patch, I thought it'd be a good
idea to upload the last version of it (with fixes above).
Btw how is everything going? Can we expect this in the next release? :)
Btw how is everything going? Can we expect this in the next release? :)
Virtuall, I visited your home page.
If you looking for good client-side web developer... We will play warsow after work every day! =)
If you looking for good client-side web developer... We will play warsow after work every day! =)
I've tried to apply it and compile source in Gentoo Linux but with
no success.
Can anyone confirm that this patch is working?
Or please provide simple instruction how to apply this patch correctly.
Can anyone confirm that this patch is working?
Or please provide simple instruction how to apply this patch correctly.
Bump!!! i think since 0.61 released we need new version of
russian-fixed binary? plz make it again, it really very usefull
fixes... and thx u for your work!

