1
0
Fork 0

clutter: Actively update ClutterText surrounding text on changes

Right now we have a bit of a mixed bag between an active model where
input foci set the surrounding text without being asked for (e.g.
wayland's text_input), and a passive model where the IM engines ask
for content.

Make ClutterText take the same side than text_input, so that dealing
with those is at least consistent.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2384>
This commit is contained in:
Carlos Garnacho 2022-04-22 18:00:24 +02:00
parent b4cdf5e098
commit a9a890164a

View file

@ -375,6 +375,8 @@ clutter_text_input_focus_delete_surrounding (ClutterInputFocus *focus,
}
if (clutter_text_get_editable (clutter_text))
clutter_text_delete_text (clutter_text, start, start + len);
clutter_text_input_focus_request_surrounding (focus);
}
static void
@ -389,6 +391,7 @@ clutter_text_input_focus_commit_text (ClutterInputFocus *focus,
clutter_text_insert_text (clutter_text, text,
clutter_text_get_cursor_position (clutter_text));
clutter_text_set_preedit_string (clutter_text, NULL, NULL, 0);
clutter_text_input_focus_request_surrounding (focus);
}
}
@ -1336,6 +1339,7 @@ update_cursor_location (ClutterText *self)
clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y);
graphene_rect_offset (&rect, x, y);
clutter_input_focus_set_cursor_location (priv->input_focus, &rect);
clutter_text_input_focus_request_surrounding (priv->input_focus);
}
static inline void