wayland-surface: Fix get_absolute_coordinates() for active transition cases
Currently, we blindly apply the transformation matrices of all parent actors when calculating the absolute coordinates. This means if this function is called while the window actor containing the surface is in the middle of a transition (e.g. window open animation), it may return incorrect values. As this function is used for calculating pointer confinement bounds for a specific surface, this will result in incorrect bounds value being used if pointer constraints are applied by the application at the same time the window is created and the mouse is inside the surface's bounds when it's created. Fix this by only applying transformation matrices up to the window actor of the surface and then calculating the absolute coordinates by adding the position of the window actor. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3585>
This commit is contained in:
parent
c63fdba6b3
commit
b6802e1f00
@ -1786,24 +1786,27 @@ meta_wayland_surface_get_relative_coordinates (MetaWaylandSurface *surface,
|
||||
}
|
||||
|
||||
void
|
||||
meta_wayland_surface_get_absolute_coordinates (MetaWaylandSurface *surface,
|
||||
float sx,
|
||||
float sy,
|
||||
meta_wayland_surface_get_absolute_coordinates (MetaWaylandSurface *surface,
|
||||
float sx,
|
||||
float sy,
|
||||
float *x,
|
||||
float *y)
|
||||
{
|
||||
ClutterActor *actor =
|
||||
CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
|
||||
MetaWindow *window = meta_wayland_surface_get_window (surface);
|
||||
ClutterActor *window_actor =
|
||||
CLUTTER_ACTOR (meta_window_actor_from_window (window));
|
||||
graphene_point3d_t sv = {
|
||||
.x = sx,
|
||||
.y = sy,
|
||||
};
|
||||
graphene_point3d_t v = { 0 };
|
||||
|
||||
clutter_actor_apply_relative_transform_to_point (actor, NULL, &sv, &v);
|
||||
clutter_actor_apply_relative_transform_to_point (actor, window_actor, &sv, &v);
|
||||
|
||||
*x = v.x;
|
||||
*y = v.y;
|
||||
*x = clutter_actor_get_x (window_actor) + v.x;
|
||||
*y = clutter_actor_get_y (window_actor) + v.y;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user