In all instances where we call ime_update_cursor_rect(), the ‘term’
argument is the same as seat->kbd_focus.
So, let ime_update_cursor_rect() use that directly instead.
Also make ime_send_cursor_rect() static (i.e. local to ime.c).
This ensures different seat’s don’t step on each others IME pre-edit
state.
It also removes most dependencies on having a valid term pointer for
many IME operations.
We’re still not all the way, since we support disabling IME with a
private mode, which is per terminal, not seat.
Thus, we still require the seat to have keyboard focus on one of our
windows.
Closes#324. But note that *rendering* of multiple seat’s IME pre-edit
strings is still broken.
We may want to be able to enable/disable IME run-time, even though we
have received an ‘enter’ IME event.
This enables us to do that.
Also add functions to enable/disable IME on a per-terminal instance
basis.
A terminal may have multiple seats focusing it, and enabling/disabling
IME in a terminal instance enables/disables IME on all those seats.
Finally, the code to enable IME is simplified; the *only* surface that
can ever receive ‘enter’ IME events is the main grid. All other
surfaces are sub-surfaces, without their own keyboard focus.