Implement basic support for input method events.

This is needed to get text input working again on Mac.
Underlines are currently being ignored.

Change-Id: I2a1074a1151e9be6f96ebe12fd0bb40a0eb63d6a
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>