surface-actor: Move out some X11-ism to X11 subclass
On X11 we don't update the texture in certain circumstances, such as if the surface is a fullscreen unredirect, or doesn't have a Pixmap. On Wayland we only want to avoid updating the texture if there is no texture, but as this is handled implicitly by MetashapedTexture, we don't need to try to emulate the X11-y conditions in the generic layer and instead just have the implementations handle update processing themself. This doesn't have any functional changes, but removes a vfunc from MetaSurfaceActorClass. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1218
This commit is contained in:
parent
99c9a14bc8
commit
510cbef15a
@ -56,6 +56,7 @@ meta_surface_actor_wayland_process_damage (MetaSurfaceActor *actor,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
meta_surface_actor_update_area (actor, x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -63,14 +64,6 @@ meta_surface_actor_wayland_pre_paint (MetaSurfaceActor *actor)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_wayland_is_visible (MetaSurfaceActor *actor)
|
||||
{
|
||||
/* TODO: ensure that the buffer isn't NULL, implement
|
||||
* wayland mapping semantics */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_wayland_is_opaque (MetaSurfaceActor *actor)
|
||||
{
|
||||
@ -167,7 +160,6 @@ meta_surface_actor_wayland_class_init (MetaSurfaceActorWaylandClass *klass)
|
||||
|
||||
surface_actor_class->process_damage = meta_surface_actor_wayland_process_damage;
|
||||
surface_actor_class->pre_paint = meta_surface_actor_wayland_pre_paint;
|
||||
surface_actor_class->is_visible = meta_surface_actor_wayland_is_visible;
|
||||
surface_actor_class->is_opaque = meta_surface_actor_wayland_is_opaque;
|
||||
|
||||
object_class->dispose = meta_surface_actor_wayland_dispose;
|
||||
|
@ -181,8 +181,8 @@ update_pixmap (MetaSurfaceActorX11 *self)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_visible (MetaSurfaceActorX11 *self)
|
||||
gboolean
|
||||
meta_surface_actor_x11_is_visible (MetaSurfaceActorX11 *self)
|
||||
{
|
||||
return (self->pixmap != None) && !self->unredirected;
|
||||
}
|
||||
@ -212,11 +212,12 @@ meta_surface_actor_x11_process_damage (MetaSurfaceActor *actor,
|
||||
self->does_full_damage = TRUE;
|
||||
}
|
||||
|
||||
if (!is_visible (self))
|
||||
if (!meta_surface_actor_x11_is_visible (self))
|
||||
return;
|
||||
|
||||
cogl_texture_pixmap_x11_update_area (COGL_TEXTURE_PIXMAP_X11 (self->texture),
|
||||
x, y, width, height);
|
||||
meta_surface_actor_update_area (actor, x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -238,13 +239,6 @@ meta_surface_actor_x11_pre_paint (MetaSurfaceActor *actor)
|
||||
update_pixmap (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_x11_is_visible (MetaSurfaceActor *actor)
|
||||
{
|
||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
||||
return is_visible (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_x11_is_opaque (MetaSurfaceActor *actor)
|
||||
{
|
||||
@ -339,7 +333,6 @@ meta_surface_actor_x11_class_init (MetaSurfaceActorX11Class *klass)
|
||||
|
||||
surface_actor_class->process_damage = meta_surface_actor_x11_process_damage;
|
||||
surface_actor_class->pre_paint = meta_surface_actor_x11_pre_paint;
|
||||
surface_actor_class->is_visible = meta_surface_actor_x11_is_visible;
|
||||
surface_actor_class->is_opaque = meta_surface_actor_x11_is_opaque;
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,8 @@ void meta_surface_actor_x11_set_unredirected (MetaSurfaceActorX11 *self,
|
||||
|
||||
gboolean meta_surface_actor_x11_is_unredirected (MetaSurfaceActorX11 *self);
|
||||
|
||||
gboolean meta_surface_actor_x11_is_visible (MetaSurfaceActorX11 *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __META_SURFACE_ACTOR_X11_H__ */
|
||||
|
@ -413,9 +413,12 @@ meta_surface_actor_get_texture (MetaSurfaceActor *self)
|
||||
return priv->texture;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
meta_surface_actor_update_area (MetaSurfaceActor *self,
|
||||
int x, int y, int width, int height)
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv =
|
||||
meta_surface_actor_get_instance_private (self);
|
||||
@ -540,9 +543,6 @@ meta_surface_actor_process_damage (MetaSurfaceActor *self,
|
||||
}
|
||||
|
||||
META_SURFACE_ACTOR_GET_CLASS (self)->process_damage (self, x, y, width, height);
|
||||
|
||||
if (meta_surface_actor_is_visible (self))
|
||||
meta_surface_actor_update_area (self, x, y, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
@ -551,12 +551,6 @@ meta_surface_actor_pre_paint (MetaSurfaceActor *self)
|
||||
META_SURFACE_ACTOR_GET_CLASS (self)->pre_paint (self);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_surface_actor_is_visible (MetaSurfaceActor *self)
|
||||
{
|
||||
return META_SURFACE_ACTOR_GET_CLASS (self)->is_visible (self);
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_set_frozen (MetaSurfaceActor *self,
|
||||
gboolean frozen)
|
||||
|
@ -25,7 +25,6 @@ struct _MetaSurfaceActorClass
|
||||
void (* process_damage) (MetaSurfaceActor *actor,
|
||||
int x, int y, int width, int height);
|
||||
void (* pre_paint) (MetaSurfaceActor *actor);
|
||||
gboolean (* is_visible) (MetaSurfaceActor *actor);
|
||||
gboolean (* is_opaque) (MetaSurfaceActor *actor);
|
||||
};
|
||||
|
||||
@ -34,6 +33,12 @@ cairo_surface_t *meta_surface_actor_get_image (MetaSurfaceActor *self,
|
||||
|
||||
MetaShapedTexture *meta_surface_actor_get_texture (MetaSurfaceActor *self);
|
||||
|
||||
void meta_surface_actor_update_area (MetaSurfaceActor *self,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
gboolean meta_surface_actor_is_obscured (MetaSurfaceActor *self);
|
||||
|
||||
void meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
||||
@ -45,7 +50,6 @@ cairo_region_t * meta_surface_actor_get_opaque_region (MetaSurfaceActor *self);
|
||||
void meta_surface_actor_process_damage (MetaSurfaceActor *actor,
|
||||
int x, int y, int width, int height);
|
||||
void meta_surface_actor_pre_paint (MetaSurfaceActor *actor);
|
||||
gboolean meta_surface_actor_is_visible (MetaSurfaceActor *actor);
|
||||
gboolean meta_surface_actor_is_opaque (MetaSurfaceActor *actor);
|
||||
|
||||
gboolean meta_surface_actor_is_frozen (MetaSurfaceActor *actor);
|
||||
|
@ -1211,7 +1211,8 @@ handle_updates (MetaWindowActorX11 *actor_x11)
|
||||
|
||||
meta_surface_actor_pre_paint (surface);
|
||||
|
||||
if (!meta_surface_actor_is_visible (surface))
|
||||
if (!META_IS_SURFACE_ACTOR_X11 (surface) ||
|
||||
!meta_surface_actor_x11_is_visible (META_SURFACE_ACTOR_X11 (surface)))
|
||||
return;
|
||||
|
||||
update_frame_bounds (actor_x11);
|
||||
|
Loading…
Reference in New Issue
Block a user