Change to using KeySyms rather than keycodes to store to-keys

Modify all code to store and manipulate KeySyms instead of KeyCodes for
output key data.

Incomplete in two places (both also noted by comments in the code):

* When creating the additional key press events I have not yet implemented
  the switch to using `XSendEvent` rather than `XTestFakeKeyEvent`. Instead
  I just convert back to a keycode assuming zero shift level and
  group. This gives the same behaviour as before.

* When checking that an event is not one that we generated I haven't managed
  to figure out how to get the keysym of the event from the data provided
  by X. Instead I compare the key codes for now, which will work until the
  above issue is fixed.