Skip to content
Snippets Groups Projects
Commit 7c75a066 authored by Wismill's avatar Wismill
Browse files

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. So `UCSConvertCase` 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 ß/ẞ:

```c
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
```

Part-of: <!274>
parent 5a7d94e0
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment