Don't commit if there is no text to commit

This fixes an annoying bug with preedit. If the user selects some text
and press a hotkey (Ctrl-C for example), PreeditBackend will consider
the hotkey unprocessable and commit, reset. Clearing the selected text.
Also switch preedit/surrounding text mode on 'set-capabilities' signal

So there is two places in which ibus_engine.py decides which backend to
use, one is do_focus_in() and the other is do_set_capabilities(). This
is needed because the two signals don't always go together as IBus may
cache the set-capabilites signal if the new capabilities are the same as
the old ones. But we cannot trust this signal as there are some
problematic clients which we want to blacklist. Hence the two places.
Remove dead code path
Force input contexts to update surrounding text on focus in

Before this commit, after a focus in, the surrounding text will stay
cached from the previous window.