instead of just getting Latin1 we practically see getting 2 or 3 bytes (even for characters that representable in Latin1) so try our best to interpret them

This commit is contained in:
Riccardo Mottola 2024-09-12 02:08:25 +02:00
parent e03ddf7b2b
commit d779c743c1

View file

@ -151,12 +151,18 @@
{
/* Always returns a Latin-1 string according to the manpage */
count = XLookupString (event, buf, BUF_LEN, &keysym, NULL);
if (count)
if (count == 1)
{
keys = [[[NSString alloc] initWithBytes: buf
length: count
encoding: NSISOLatin1StringEncoding] autorelease];
}
else if (count > 1) // manpage lies and we suppose UTF-8
{
keys = [[[NSString alloc] initWithBytes: buf
length: count
encoding: NSUTF8StringEncoding] autorelease];
}
if (keysymptr)
*keysymptr = keysym;