ime: don’t pass ‘term’ to ime_update_cursor_rect()

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 commit is contained in:
Daniel Eklöf 2021-03-23 13:56:33 +01:00
parent 1c355f7b7f
commit 13b45db13e
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 12 additions and 10 deletions

15
ime.c
View file

@ -344,8 +344,8 @@ ime_reset_preedit(struct seat *seat)
seat->ime.preedit.count = 0;
}
void
ime_send_cursor_rect(struct seat *seat, struct terminal *term)
static void
ime_send_cursor_rect(struct seat *seat)
{
if (unlikely(seat->wayl->text_input_manager == NULL))
return;
@ -353,6 +353,8 @@ ime_send_cursor_rect(struct seat *seat, struct terminal *term)
if (!seat->ime.focused)
return;
struct terminal *term = seat->kbd_focus;
if (!term->ime_enabled)
return;
@ -437,8 +439,10 @@ ime_disable(struct seat *seat)
}
void
ime_update_cursor_rect(struct seat *seat, struct terminal *term)
ime_update_cursor_rect(struct seat *seat)
{
struct terminal *term = seat->kbd_focus;
/* Set in render_ime_preedit() */
if (seat->ime.preedit.cells != NULL)
goto update;
@ -469,7 +473,7 @@ ime_update_cursor_rect(struct seat *seat, struct terminal *term)
seat->ime.cursor_rect.pending.height = height;
update:
ime_send_cursor_rect(seat, term);
ime_send_cursor_rect(seat);
}
const struct zwp_text_input_v3_listener text_input_listener = {
@ -485,12 +489,11 @@ const struct zwp_text_input_v3_listener text_input_listener = {
void ime_enable(struct seat *seat) {}
void ime_disable(struct seat *seat) {}
void ime_update_cursor_rect(struct seat *seat, struct terminal *term) {}
void ime_update_cursor_rect(struct seat *seat) {}
void ime_reset_pending_preedit(struct seat *seat) {}
void ime_reset_pending_commit(struct seat *seat) {}
void ime_reset_pending(struct seat *seat) {}
void ime_reset_preedit(struct seat *seat) {}
void ime_send_cursor_rect(struct seat *seat, struct terminal *term) {}
#endif