From ebf9f18080c9c6b2df4329191391d007b0ea8cf2 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 19 Nov 2020 18:15:34 +0800 Subject: [PATCH] clutter/text: Make update_cursor_location() operate in stage coordinates Until now we would `clutter_input_focus_set_cursor_location` with cursor-rectangle-in-physical-pixels + actor-location-in-stage-coordinates. But those use different scaling factors so it only got the right answer when the framebuffer scale was 1.0. This directly determines the geometry of the invisible dummy cursor in gnome-shell ibusCandidatePopup.js: ``` panelService.connect('set-cursor-location', (ps, x, y, w, h) => { this._setDummyCursorGeometry(x, y, w, h); }); ``` And because it's invisible it wasn't obvious that it was wrong until you enable `CLUTTER_PAINT=damage-region` and you can see its ghost at the wrong offset and scale. So now we `clutter_input_focus_set_cursor_location` using purely unscaled stage coordinates. And `CLUTTER_PAINT=damage-region` shows that gnome-shell's `_dummyCursor` is placed precisely over the visible cursor. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3399 and probably other IBus issues that arise when using framebuffer scaling. Part-of: --- clutter/clutter/clutter-text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c index 98fa0772a..159fa330e 100644 --- a/clutter/clutter/clutter-text.c +++ b/clutter/clutter/clutter-text.c @@ -1307,7 +1307,7 @@ update_cursor_location (ClutterText *self) if (!priv->editable) return; - rect = priv->cursor_rect; + clutter_text_get_cursor_rect (self, &rect); 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);