[mutter] wayland/actor-surface: Consider clones in is_on_logical_monitor()
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/actor-surface: Consider clones in is_on_logical_monitor()
- Date: Mon, 11 Jul 2022 21:18:15 +0000 (UTC)
commit 1a56a53909550b6a1e7f59c93e4e57a139158aaa
Author: Robert Mader <robert mader posteo de>
Date: Fri Jul 8 23:45:16 2022 +0200
wayland/actor-surface: Consider clones in is_on_logical_monitor()
While the check for `clutter_actor_has_mapped_clones` clearly indicates
an intention to take clones into account, the following code
does not do so, likely because it predates the introduction of
`clutter_actor_is_effectively_on_stage_view()`.
Switch to that newer API in order to take clones into account. This
avoids unnecessary `wl_surface_send_enter()` and `wl_surface_send_leave()`
events when entering the overview, reducing client work.
This also avoids unnecessarily allocating a `cairo_region_t`.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2502>
src/wayland/meta-wayland-actor-surface.c | 45 ++++++++++++--------------------
1 file changed, 16 insertions(+), 29 deletions(-)
---
diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c
index 697fff53d0..362785c89c 100644
--- a/src/wayland/meta-wayland-actor-surface.c
+++ b/src/wayland/meta-wayland-actor-surface.c
@@ -321,42 +321,29 @@ meta_wayland_actor_surface_is_on_logical_monitor (MetaWaylandSurfaceRole *surfac
{
MetaWaylandActorSurfacePrivate *priv =
meta_wayland_actor_surface_get_instance_private (META_WAYLAND_ACTOR_SURFACE (surface_role));
+ MetaBackend *backend = meta_get_backend ();
+ MetaRenderer *renderer = meta_backend_get_renderer (backend);
ClutterActor *actor = CLUTTER_ACTOR (priv->actor);
- float x, y, width, height;
- cairo_rectangle_int_t actor_rect;
- cairo_region_t *region;
MetaRectangle logical_monitor_layout;
- gboolean is_on_monitor;
-
- if (!clutter_actor_is_mapped (actor) &&
- !clutter_actor_has_mapped_clones (actor))
- return FALSE;
-
- clutter_actor_get_transformed_position (actor, &x, &y);
- clutter_actor_get_transformed_size (actor, &width, &height);
-
- actor_rect.x = (int) roundf (x);
- actor_rect.y = (int) roundf (y);
- actor_rect.width = (int) roundf (x + width) - actor_rect.x;
- actor_rect.height = (int) roundf (y + height) - actor_rect.y;
-
- /* Calculate the scaled surface actor region. */
- region = cairo_region_create_rectangle (&actor_rect);
+ GList *l;
logical_monitor_layout = meta_logical_monitor_get_layout (logical_monitor);
- cairo_region_intersect_rectangle (region,
- &((cairo_rectangle_int_t) {
- .x = logical_monitor_layout.x,
- .y = logical_monitor_layout.y,
- .width = logical_monitor_layout.width,
- .height = logical_monitor_layout.height,
- }));
+ for (l = meta_renderer_get_views (renderer); l; l = l->next)
+ {
+ ClutterStageView *stage_view = l->data;
+ MetaRectangle view_layout;
+
+ clutter_stage_view_get_layout (stage_view, &view_layout);
- is_on_monitor = !cairo_region_is_empty (region);
- cairo_region_destroy (region);
+ if (meta_rectangle_overlap (&logical_monitor_layout,
+ &view_layout) &&
+ clutter_actor_is_effectively_on_stage_view (CLUTTER_ACTOR (actor),
+ stage_view))
+ return TRUE;
+ }
- return is_on_monitor;
+ return FALSE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]