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 (#50)

This commit is contained in:
Riccardo 2024-09-19 08:32:46 +02:00 committed by GitHub
parent ba1c582024
commit 4e3ca27c0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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;