mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
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:
parent
6968f17f3f
commit
ad138210b3
@ -93,4 +93,6 @@ void meta_window_actor_set_geometry_scale (MetaWindowActor *window_actor,
|
|||||||
|
|
||||||
int meta_window_actor_get_geometry_scale (MetaWindowActor *window_actor);
|
int meta_window_actor_get_geometry_scale (MetaWindowActor *window_actor);
|
||||||
|
|
||||||
|
void meta_window_actor_notify_damaged (MetaWindowActor *window_actor);
|
||||||
|
|
||||||
#endif /* META_WINDOW_ACTOR_PRIVATE_H */
|
#endif /* META_WINDOW_ACTOR_PRIVATE_H */
|
||||||
|
@ -115,6 +115,7 @@ enum
|
|||||||
{
|
{
|
||||||
FIRST_FRAME,
|
FIRST_FRAME,
|
||||||
EFFECTS_COMPLETED,
|
EFFECTS_COMPLETED,
|
||||||
|
DAMAGED,
|
||||||
|
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
@ -219,6 +220,20 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
|
|||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MetaWindowActor::damaged:
|
||||||
|
* @actor: the #MetaWindowActor instance
|
||||||
|
*
|
||||||
|
* Notify that one or more of the surfaces of the window have been damaged.
|
||||||
|
*/
|
||||||
|
signals[DAMAGED] =
|
||||||
|
g_signal_new ("damaged",
|
||||||
|
G_TYPE_FROM_CLASS (object_class),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
0,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
pspec = g_param_spec_object ("meta-window",
|
pspec = g_param_spec_object ("meta-window",
|
||||||
"MetaWindow",
|
"MetaWindow",
|
||||||
"The displayed MetaWindow",
|
"The displayed MetaWindow",
|
||||||
@ -1498,6 +1513,8 @@ meta_window_actor_process_x11_damage (MetaWindowActor *self,
|
|||||||
event->area.y,
|
event->area.y,
|
||||||
event->area.width,
|
event->area.width,
|
||||||
event->area.height);
|
event->area.height);
|
||||||
|
|
||||||
|
meta_window_actor_notify_damaged (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2111,3 +2128,9 @@ meta_window_actor_from_actor (ClutterActor *actor)
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_window_actor_notify_damaged (MetaWindowActor *window_actor)
|
||||||
|
{
|
||||||
|
g_signal_emit (window_actor, signals[DAMAGED], 0);
|
||||||
|
}
|
||||||
|
@ -672,6 +672,8 @@ void
|
|||||||
meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface,
|
meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface,
|
||||||
MetaWaylandPendingState *pending)
|
MetaWaylandPendingState *pending)
|
||||||
{
|
{
|
||||||
|
gboolean had_damage = FALSE;
|
||||||
|
|
||||||
if (surface->role)
|
if (surface->role)
|
||||||
{
|
{
|
||||||
meta_wayland_surface_role_pre_commit (surface->role, pending);
|
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) ||
|
if (!cairo_region_is_empty (pending->surface_damage) ||
|
||||||
!cairo_region_is_empty (pending->buffer_damage))
|
!cairo_region_is_empty (pending->buffer_damage))
|
||||||
surface_process_damage (surface,
|
{
|
||||||
pending->surface_damage,
|
surface_process_damage (surface,
|
||||||
pending->buffer_damage);
|
pending->surface_damage,
|
||||||
|
pending->buffer_damage);
|
||||||
|
had_damage = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
surface->offset_x += pending->dx;
|
surface->offset_x += pending->dx;
|
||||||
surface->offset_y += pending->dy;
|
surface->offset_y += pending->dy;
|
||||||
@ -844,6 +849,22 @@ cleanup:
|
|||||||
G_TRAVERSE_ALL,
|
G_TRAVERSE_ALL,
|
||||||
parent_surface_state_applied,
|
parent_surface_state_applied,
|
||||||
NULL);
|
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
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user