Improve keyboard handling

For some IBus keyboards (like Danish-post(m17n)) we want to commit
the pre-edit text when the user moves away from the (sub-)field.

This change implements the FieldWorks side of the change in Palaso
(https://gerrit.lsdev.sil.org/1559).

Change-Id: Idb97b1cc64e7ce58146aeb2de5ffb9d0e703c2c6