wayland/actor-surface: Turn get_geometry_scale() into a vfunc

This allows us to implement more sophisticated logic for the different
cases. For DnD surfaces, use the geometry scale of the monitor where
the pointer is, instead of incorrectly assuming '1' as it was before.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/780
This commit is contained in:
Robert Mader
2019-09-06 15:13:24 +02:00
committed by Jonas Ådahl
parent dbe9daeb76
commit bba8f6c53e
6 changed files with 88 additions and 18 deletions

View File

@ -240,6 +240,28 @@ meta_wayland_subsurface_get_toplevel (MetaWaylandSurfaceRole *surface_role)
return NULL;
}
static double
meta_wayland_subsurface_get_geometry_scale (MetaWaylandActorSurface *actor_surface)
{
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (actor_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandSurface *parent = surface->sub.parent;
if (parent)
{
MetaWaylandActorSurface *parent_actor;
parent_actor = META_WAYLAND_ACTOR_SURFACE (surface->sub.parent->role);
return meta_wayland_actor_surface_get_geometry_scale (parent_actor);
}
else
{
return 1;
}
}
static void
meta_wayland_subsurface_sync_actor_state (MetaWaylandActorSurface *actor_surface)
{
@ -273,6 +295,8 @@ meta_wayland_subsurface_class_init (MetaWaylandSubsurfaceClass *klass)
surface_role_class->get_toplevel = meta_wayland_subsurface_get_toplevel;
actor_surface_class->get_geometry_scale =
meta_wayland_subsurface_get_geometry_scale;
actor_surface_class->sync_actor_state =
meta_wayland_subsurface_sync_actor_state;
}