diff --git a/clutter/clutter/clutter-mutter.h b/clutter/clutter/clutter-mutter.h index b383ff518..04efa5d86 100644 --- a/clutter/clutter/clutter-mutter.h +++ b/clutter/clutter/clutter-mutter.h @@ -38,6 +38,11 @@ #include "clutter-stage-view-private.h" #include "clutter.h" +/* An epsilon larger than FLT_EPSILON that is useful when comparing coordinates + * while ignoring floating point precision loss that might happen during + * various matrix calculations. */ +#define CLUTTER_COORDINATE_EPSILON (1.0 / 256.0) + typedef struct _ClutterMainContext ClutterContext; typedef ClutterBackend * (* ClutterBackendConstructor) (gpointer user_data); diff --git a/src/compositor/meta-compositor-view-native.c b/src/compositor/meta-compositor-view-native.c index 932d43a3b..4c7e7f7a8 100644 --- a/src/compositor/meta-compositor-view-native.c +++ b/src/compositor/meta-compositor-view-native.c @@ -83,6 +83,8 @@ find_scanout_candidate (MetaCompositorView *compositor_view, CoglFramebuffer *framebuffer; MetaWindowActor *window_actor; MetaWindow *window; + MetaRectangle view_rect; + ClutterActorBox actor_box; MetaSurfaceActor *surface_actor; MetaSurfaceActorWayland *surface_actor_wayland; MetaWaylandSurface *surface; @@ -126,6 +128,21 @@ find_scanout_candidate (MetaCompositorView *compositor_view, if (meta_surface_actor_is_obscured (surface_actor)) return FALSE; + if (!clutter_actor_get_paint_box (CLUTTER_ACTOR (surface_actor), + &actor_box)) + return FALSE; + + clutter_stage_view_get_layout (stage_view, &view_rect); + if (!G_APPROX_VALUE (actor_box.x1, view_rect.x, + CLUTTER_COORDINATE_EPSILON) || + !G_APPROX_VALUE (actor_box.y1, view_rect.y, + CLUTTER_COORDINATE_EPSILON) || + !G_APPROX_VALUE (actor_box.x2, view_rect.x + view_rect.width, + CLUTTER_COORDINATE_EPSILON) || + !G_APPROX_VALUE (actor_box.y2, view_rect.y + view_rect.height, + CLUTTER_COORDINATE_EPSILON)) + return FALSE; + surface_actor_wayland = META_SURFACE_ACTOR_WAYLAND (surface_actor); surface = meta_surface_actor_wayland_get_surface (surface_actor_wayland); if (!surface)