diff options
author | Daniel van Vugt <daniel.van.vugt@canonical.com> | 2020-11-19 18:09:27 +0800 |
---|---|---|
committer | Marge Bot <marge-bot@gnome.org> | 2020-12-12 08:18:49 +0000 |
commit | db30a4d7b41fe5a016052b2b73fed5aa81c27280 (patch) | |
tree | d68dee68f3dbd7e42681ce744b2fff1540cd83ad | |
parent | 0bace8dbde4945f8f8d4b633934bbdb50e1200d0 (diff) | |
download | mutter-db30a4d7b41fe5a016052b2b73fed5aa81c27280.tar.gz |
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>
-rw-r--r-- | clutter/clutter/clutter-text.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c index 4967b0258..98fa0772a 100644 --- a/clutter/clutter/clutter-text.c +++ b/clutter/clutter/clutter-text.c @@ -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 |