window-actor: Add 'damaged' signal

Make it possible to listen for damage on a window actor. For X11, the
signal is emitted when damage is reported; for Wayland, it is emitted
when any of the surfaces associated with the window is damaged.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/752
This commit is contained in:
Jonas Ådahl
2019-08-26 16:09:53 +03:00
parent 6968f17f3f
commit ad138210b3
3 changed files with 49 additions and 3 deletions

View File

@@ -672,6 +672,8 @@ void
meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface,
MetaWaylandPendingState *pending)
{
gboolean had_damage = FALSE;
if (surface->role)
{
meta_wayland_surface_role_pre_commit (surface->role, pending);
@@ -778,9 +780,12 @@ meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface,
if (!cairo_region_is_empty (pending->surface_damage) ||
!cairo_region_is_empty (pending->buffer_damage))
surface_process_damage (surface,
pending->surface_damage,
pending->buffer_damage);
{
surface_process_damage (surface,
pending->surface_damage,
pending->buffer_damage);
had_damage = TRUE;
}
surface->offset_x += pending->dx;
surface->offset_y += pending->dy;
@@ -844,6 +849,22 @@ cleanup:
G_TRAVERSE_ALL,
parent_surface_state_applied,
NULL);
if (had_damage)
{
MetaWindow *toplevel_window;
toplevel_window = meta_wayland_surface_get_toplevel_window (surface);
if (toplevel_window)
{
MetaWindowActor *toplevel_window_actor;
toplevel_window_actor =
meta_window_actor_from_window (toplevel_window);
if (toplevel_window_actor)
meta_window_actor_notify_damaged (toplevel_window_actor);
}
}
}
static void