shell-util: Do not scale the clip in get_content_for_window_actor()

This is now handled in Mutter. Also, respect the result size instead
of assuming it to be equal to the clip size, as the clip takes actor
coordinates while the result takes buffer coordinates.

This can be fixed in a future API iteration.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/728
This commit is contained in:
Robert Mader 2019-09-14 19:24:36 +02:00 committed by Jonas Ådahl
parent a0d0a17d68
commit 506b75fc7f

View File

@ -429,28 +429,20 @@ shell_util_get_content_for_window_actor (MetaWindowActor *window_actor,
cairo_surface_t *surface; cairo_surface_t *surface;
cairo_rectangle_int_t clip; cairo_rectangle_int_t clip;
gfloat actor_x, actor_y; gfloat actor_x, actor_y;
gfloat resource_scale;
clutter_actor_get_position (CLUTTER_ACTOR (window_actor), &actor_x, &actor_y); clutter_actor_get_position (CLUTTER_ACTOR (window_actor), &actor_x, &actor_y);
if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (window_actor),
&resource_scale))
{
resource_scale = 1.0;
g_warning ("Actor resource scale is not know at this point, "
"falling back to default 1.0");
}
clip.x = window_rect->x - (gint) actor_x; clip.x = window_rect->x - (gint) actor_x;
clip.y = window_rect->y - (gint) actor_y; clip.y = window_rect->y - (gint) actor_y;
clip.width = ceilf (window_rect->width * resource_scale); clip.width = window_rect->width;
clip.height = ceilf (window_rect->height * resource_scale); clip.height = window_rect->height;
surface = meta_window_actor_get_image (window_actor, &clip); surface = meta_window_actor_get_image (window_actor, &clip);
content = clutter_canvas_new (); content = clutter_canvas_new ();
clutter_canvas_set_size (CLUTTER_CANVAS (content), clutter_canvas_set_size (CLUTTER_CANVAS (content),
clip.width, clip.height); cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface));
g_signal_connect (content, "draw", g_signal_connect (content, "draw",
G_CALLBACK (canvas_draw_cb), surface); G_CALLBACK (canvas_draw_cb), surface);
clutter_content_invalidate (content); clutter_content_invalidate (content);