mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
wayland/actor-surface: Set geometry scale in surface actor
Now that MetaShapedTexture is a ClutterContent implemetation that is aware of its own buffer scale, it is possible to simplify the event translation routines. Set the geometry scale in MetaSurfaceActor, and stop adjusting the surface scale when translating points. Also remove the now obsoleted meta_wayland_actor_surface_calculate_scale() function. https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
This commit is contained in:
parent
75cffd0ec4
commit
d3f30d9ece
@ -104,7 +104,7 @@ meta_wayland_actor_surface_queue_frame_callbacks (MetaWaylandActorSurface *actor
|
||||
wl_list_init (&pending->frame_callback_list);
|
||||
}
|
||||
|
||||
static double
|
||||
double
|
||||
meta_wayland_actor_surface_get_geometry_scale (MetaWaylandActorSurface *actor_surface)
|
||||
{
|
||||
MetaWaylandSurfaceRole *surface_role =
|
||||
@ -128,21 +128,6 @@ meta_wayland_actor_surface_get_geometry_scale (MetaWaylandActorSurface *actor_su
|
||||
}
|
||||
}
|
||||
|
||||
double
|
||||
meta_wayland_actor_surface_calculate_scale (MetaWaylandActorSurface *actor_surface)
|
||||
{
|
||||
MetaWaylandSurfaceRole *surface_role =
|
||||
META_WAYLAND_SURFACE_ROLE (actor_surface);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
double geometry_scale;
|
||||
|
||||
geometry_scale =
|
||||
meta_wayland_actor_surface_get_geometry_scale (actor_surface);
|
||||
|
||||
return geometry_scale / (double) surface->scale;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor_surface)
|
||||
{
|
||||
@ -164,6 +149,9 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
|
||||
|
||||
/* Wayland surface coordinate space -> stage coordinate space */
|
||||
geometry_scale = meta_wayland_actor_surface_get_geometry_scale (actor_surface);
|
||||
clutter_actor_set_scale (CLUTTER_ACTOR (surface_actor),
|
||||
geometry_scale,
|
||||
geometry_scale);
|
||||
|
||||
surface_rect = (cairo_rectangle_int_t) {
|
||||
.width = meta_wayland_surface_get_width (surface) * geometry_scale,
|
||||
|
@ -37,9 +37,7 @@ struct _MetaWaylandActorSurfaceClass
|
||||
};
|
||||
|
||||
void meta_wayland_actor_surface_sync_actor_state (MetaWaylandActorSurface *actor_surface);
|
||||
|
||||
double meta_wayland_actor_surface_calculate_scale (MetaWaylandActorSurface *actor_surface);
|
||||
|
||||
double meta_wayland_actor_surface_get_geometry_scale (MetaWaylandActorSurface *actor_surface);
|
||||
MetaSurfaceActor * meta_wayland_actor_surface_get_actor (MetaWaylandActorSurface *actor_surface);
|
||||
void meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface);
|
||||
|
||||
|
@ -153,8 +153,7 @@ meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole *surface_role
|
||||
MetaWaylandSurfaceRoleClass *surface_role_class;
|
||||
MetaWindow *window;
|
||||
MetaWaylandBuffer *buffer;
|
||||
CoglTexture *texture;
|
||||
double scale;
|
||||
double geometry_scale;
|
||||
|
||||
surface_role_class =
|
||||
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_shell_surface_parent_class);
|
||||
@ -168,11 +167,12 @@ meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole *surface_role
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
scale = meta_wayland_actor_surface_calculate_scale (actor_surface);
|
||||
texture = meta_wayland_surface_get_texture (surface);
|
||||
geometry_scale = meta_wayland_actor_surface_get_geometry_scale (actor_surface);
|
||||
|
||||
window->buffer_rect.width = cogl_texture_get_width (texture) * scale;
|
||||
window->buffer_rect.height = cogl_texture_get_height (texture) * scale;
|
||||
window->buffer_rect.width =
|
||||
meta_wayland_surface_get_width (surface) * geometry_scale;
|
||||
window->buffer_rect.height =
|
||||
meta_wayland_surface_get_height (surface) * geometry_scale;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1584,8 +1584,6 @@ meta_wayland_surface_get_relative_coordinates (MetaWaylandSurface *surface,
|
||||
CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
|
||||
|
||||
clutter_actor_transform_stage_point (actor, abs_x, abs_y, sx, sy);
|
||||
*sx /= surface->scale;
|
||||
*sy /= surface->scale;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user