1
0
Fork 0

clutter/text: Scale down clutter_text_get_cursor_rect to actor coordinates

`priv->cursor_rect` is stored in physical pixels, not local coordinates.
So unscale it before returning from `clutter_text_get_cursor_rect`, which
is explicitly documented as returning "actor-relative coordinates".

This went missed with fractional scaling support, and unnoticed as nobody
uses `clutter_text_get_cursor_rect` yet. But that will soon change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1576>
This commit is contained in:
Daniel van Vugt 2020-11-19 18:09:27 +08:00 committed by Marge Bot
parent 0bace8dbde
commit db30a4d7b4

View file

@ -6793,10 +6793,17 @@ void
clutter_text_get_cursor_rect (ClutterText *self,
graphene_rect_t *rect)
{
float inverse_scale;
g_return_if_fail (CLUTTER_IS_TEXT (self));
g_return_if_fail (rect != NULL);
*rect = self->priv->cursor_rect;
inverse_scale = 1.f / clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
graphene_rect_scale (&self->priv->cursor_rect,
inverse_scale,
inverse_scale,
rect);
}
void