Skip to content

Commit

Permalink
text_input: only send surrounding_text and content_type if available
Browse files Browse the repository at this point in the history
  • Loading branch information
tadeokondrak committed Jan 2, 2021
1 parent a5dbdd3 commit 7478170
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions sway/input/text_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,18 @@ static void relay_send_im_state(struct sway_input_method_relay *relay,
return;
}
// TODO: only send each of those if they were modified
wlr_input_method_v2_send_surrounding_text(input_method,
input->current.surrounding.text, input->current.surrounding.cursor,
input->current.surrounding.anchor);
if (input->current.features & WLR_TEXT_INPUT_V3_FEATURE_SURROUNDING_TEXT) {
wlr_input_method_v2_send_surrounding_text(input_method,
input->current.surrounding.text, input->current.surrounding.cursor,
input->current.surrounding.anchor);
}
wlr_input_method_v2_send_text_change_cause(input_method,
input->current.text_change_cause);
wlr_input_method_v2_send_content_type(input_method,
input->current.content_type.hint, input->current.content_type.purpose);
if (input->current.features & WLR_TEXT_INPUT_V3_FEATURE_CONTENT_TYPE) {
wlr_input_method_v2_send_content_type(input_method,
input->current.content_type.hint,
input->current.content_type.purpose);
}
wlr_input_method_v2_send_done(input_method);
// TODO: pass intent, display popup size
}
Expand Down

0 comments on commit 7478170

Please sign in to comment.