[mutter] window-actor: Move culling logic into child classes
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window-actor: Move culling logic into child classes
- Date: Mon, 10 Oct 2022 19:12:55 +0000 (UTC)
commit 0034b54877138d384fa791ff66f009e48b6247f6
Author: Sebastian Wick <sebastian wick redhat com>
Date: Tue Mar 15 11:34:26 2022 +0100
window-actor: Move culling logic into child classes
Prepare for adding Wayland specific culling logic to the
MetaWindowActorWayland class by moving all the logic to the non-abstract
classes, since there will be no reason to keep the logic in
MetaWindowActor around.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>
src/compositor/meta-window-actor-wayland.c | 31 +++++++++++++++++++++++++++++-
src/compositor/meta-window-actor-x11.c | 10 ++++------
src/compositor/meta-window-actor.c | 26 -------------------------
3 files changed, 34 insertions(+), 33 deletions(-)
---
diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c
index 93f12a7d67..a135d2805e 100644
--- a/src/compositor/meta-window-actor-wayland.c
+++ b/src/compositor/meta-window-actor-wayland.c
@@ -22,6 +22,7 @@
#include "config.h"
+#include "compositor/meta-cullable.h"
#include "compositor/meta-surface-actor-wayland.h"
#include "compositor/meta-window-actor-wayland.h"
#include "meta/meta-window-actor.h"
@@ -32,7 +33,12 @@ struct _MetaWindowActorWayland
MetaWindowActor parent;
};
-G_DEFINE_TYPE (MetaWindowActorWayland, meta_window_actor_wayland, META_TYPE_WINDOW_ACTOR)
+static void cullable_iface_init (MetaCullableInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (MetaWindowActorWayland, meta_window_actor_wayland,
+ META_TYPE_WINDOW_ACTOR,
+ G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
+ cullable_iface_init))
typedef struct _SurfaceTreeTraverseData
{
@@ -125,6 +131,29 @@ meta_window_actor_wayland_rebuild_surface_tree (MetaWindowActor *actor)
&traverse_data);
}
+static void
+meta_window_actor_wayland_cull_out (MetaCullable *cullable,
+ cairo_region_t *unobscured_region,
+ cairo_region_t *clip_region)
+{
+ meta_cullable_cull_out_children (cullable,
+ unobscured_region,
+ clip_region);
+}
+
+static void
+meta_window_actor_wayland_reset_culling (MetaCullable *cullable)
+{
+ meta_cullable_reset_culling_children (cullable);
+}
+
+static void
+cullable_iface_init (MetaCullableInterface *iface)
+{
+ iface->cull_out = meta_window_actor_wayland_cull_out;
+ iface->reset_culling = meta_window_actor_wayland_reset_culling;
+}
+
static MetaSurfaceActor *
meta_window_actor_wayland_get_scanout_candidate (MetaWindowActor *actor)
{
diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c
index 1b591df46a..158b912191 100644
--- a/src/compositor/meta-window-actor-x11.c
+++ b/src/compositor/meta-window-actor-x11.c
@@ -106,8 +106,6 @@ struct _MetaWindowActorX11
gboolean is_frozen;
};
-static MetaCullableInterface *cullable_parent_iface;
-
static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaWindowActorX11, meta_window_actor_x11, META_TYPE_WINDOW_ACTOR,
@@ -1633,7 +1631,9 @@ meta_window_actor_x11_cull_out (MetaCullable *cullable,
{
MetaWindowActorX11 *self = META_WINDOW_ACTOR_X11 (cullable);
- cullable_parent_iface->cull_out (cullable, unobscured_region, clip_region);
+ meta_cullable_cull_out_children (cullable,
+ unobscured_region,
+ clip_region);
set_clip_region_beneath (self, clip_region);
}
@@ -1645,14 +1645,12 @@ meta_window_actor_x11_reset_culling (MetaCullable *cullable)
g_clear_pointer (&actor_x11->shadow_clip, cairo_region_destroy);
- cullable_parent_iface->reset_culling (cullable);
+ meta_cullable_reset_culling_children (cullable);
}
static void
cullable_iface_init (MetaCullableInterface *iface)
{
- cullable_parent_iface = g_type_interface_peek_parent (iface);
-
iface->cull_out = meta_window_actor_x11_cull_out;
iface->reset_culling = meta_window_actor_x11_reset_culling;
}
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index b39bfc632c..85309eeb64 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -27,7 +27,6 @@
#include "backends/meta-screen-cast-window.h"
#include "compositor/compositor-private.h"
-#include "compositor/meta-cullable.h"
#include "compositor/meta-shaped-texture-private.h"
#include "compositor/meta-surface-actor-x11.h"
#include "compositor/meta-surface-actor.h"
@@ -114,13 +113,10 @@ static MetaSurfaceActor * meta_window_actor_real_get_scanout_candidate (MetaWind
static void meta_window_actor_real_assign_surface_actor (MetaWindowActor *self,
MetaSurfaceActor *surface_actor);
-static void cullable_iface_init (MetaCullableInterface *iface);
-
static void screen_cast_window_iface_init (MetaScreenCastWindowInterface *iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaWindowActor)
- G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init)
G_IMPLEMENT_INTERFACE (META_TYPE_SCREEN_CAST_WINDOW,
screen_cast_window_iface_init));
static void
@@ -1035,28 +1031,6 @@ see_region (cairo_region_t *region,
}
#endif
-
-static void
-meta_window_actor_cull_out (MetaCullable *cullable,
- cairo_region_t *unobscured_region,
- cairo_region_t *clip_region)
-{
- meta_cullable_cull_out_children (cullable, unobscured_region, clip_region);
-}
-
-static void
-meta_window_actor_reset_culling (MetaCullable *cullable)
-{
- meta_cullable_reset_culling_children (cullable);
-}
-
-static void
-cullable_iface_init (MetaCullableInterface *iface)
-{
- iface->cull_out = meta_window_actor_cull_out;
- iface->reset_culling = meta_window_actor_reset_culling;
-}
-
void
meta_window_actor_sync_visibility (MetaWindowActor *self)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]