Fix misuse of UCSConvertCase in XConvertCase
There are two issues with the use of UCSConvertCase
in XConvertCase
:
- Some Latin-1 keysyms do not map within Latin-1, e.g.
ssharp
. Only Latin-1 keysyms have the same value as the Unicode code point of their corresponding character. SoUCSConvertCase
does not work for some Latin-1 keysyms as it returns Unicode code points outside Latin-1 that do not match their corresponding keysyms values. - Some Unicode keysyms should map to Latin-1 keysyms (<0x100). But the
Unicode keysym mask 0x01000000 is applied blindly to the result of
UCSConvertCase
, resulting in invalid Unicode keysyms (0x010000nn) while they should be Latin-1 keysyms.
Example with ß/ẞ:
KeySym lower, upper;
XConvertCase(XK_ssharp, &lower, &upper);
// Expected: lower == XK_ssharp, upper == U1E9E
// Got: lower == XK_ssharp, upper == 0x1E9E
XConvertCase(U1E9E, &lower, &upper);
// Expected: lower == XK_ssharp, upper == U1E9E
// Got: lower == 0x10000df, upper == U1E9E
See #110 (closed) and !30 (merged).
Edited by Wismill