1
0
Fork 0

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>
This commit is contained in:
Sebastian Wick 2022-03-15 11:34:26 +01:00 committed by Marge Bot
parent 8832a5a1c2
commit 0034b54877
3 changed files with 34 additions and 33 deletions

View file

@ -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)
{

View file

@ -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;
}

View file

@ -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)
{