Certain key combinations got mapped to the wrong keycode, perhaps most
notably pressing Shift+, to type "<" got mapped to ">". This was caused
by XKeySymToKeycode() not being aware of the current modifier state.
The solution is to use XKB instead and keep track of the pressed keys.
The same bug appeared in TigerVNC's x0vncserver, so this is essentially
a port of that fix:
https://github.com/TigerVNC/tigervnc/issues/491
https://github.com/TigerVNC/tigervnc/commit/ac73038232dd7d6e41006357de2120f580b9f05f
BUG: 391079