wayland: Add MetaWaylandSurface::geometry-changed signal

Abstract this instead of having callers connect to notify:: signals
on the surface actor.
This commit is contained in:
Carlos Garnacho 2018-04-06 12:35:34 +02:00
parent 70036429bd
commit b12c92e206
3 changed files with 27 additions and 21 deletions

View File

@ -664,17 +664,8 @@ meta_pointer_confinement_wayland_maybe_warp (MetaPointerConfinementWayland *self
}
static void
surface_actor_allocation_notify (MetaSurfaceActorWayland *surface_actor,
GParamSpec *pspec,
MetaPointerConfinementWayland *self)
{
meta_pointer_confinement_wayland_maybe_warp (self);
}
static void
surface_actor_position_notify (MetaSurfaceActorWayland *surface_actor,
GParamSpec *pspec,
MetaPointerConfinementWayland *self)
surface_actor_geometry_changed (MetaSurfaceActorWayland *surface_actor,
MetaPointerConfinementWayland *self)
{
meta_pointer_confinement_wayland_maybe_warp (self);
}
@ -700,13 +691,8 @@ meta_pointer_confinement_wayland_new (MetaWaylandPointerConstraint *constraint)
surface = meta_wayland_pointer_constraint_get_surface (constraint);
g_signal_connect_object (meta_wayland_surface_get_actor (surface),
"notify::allocation",
G_CALLBACK (surface_actor_allocation_notify),
confinement,
0);
g_signal_connect_object (meta_wayland_surface_get_actor (surface),
"notify::position",
G_CALLBACK (surface_actor_position_notify),
"geometry-changed",
G_CALLBACK (surface_actor_geometry_changed),
confinement,
0);
if (surface->window)

View File

@ -105,6 +105,7 @@ enum {
SURFACE_CONFIGURE,
SURFACE_SHORTCUTS_INHIBITED,
SURFACE_SHORTCUTS_RESTORED,
SURFACE_GEOMETRY_CHANGED,
N_SURFACE_SIGNALS
};
@ -1237,7 +1238,7 @@ surface_actor_mapped_notify (MetaSurfaceActorWayland *surface_actor,
GParamSpec *pspec,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
g_signal_emit (surface, surface_signals[SURFACE_GEOMETRY_CHANGED], 0);
}
static void
@ -1245,7 +1246,7 @@ surface_actor_allocation_notify (MetaSurfaceActorWayland *surface_actor,
GParamSpec *pspec,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
g_signal_emit (surface, surface_signals[SURFACE_GEOMETRY_CHANGED], 0);
}
static void
@ -1253,7 +1254,7 @@ surface_actor_position_notify (MetaSurfaceActorWayland *surface_actor,
GParamSpec *pspec,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
g_signal_emit (surface, surface_signals[SURFACE_GEOMETRY_CHANGED], 0);
}
static void
@ -1536,6 +1537,10 @@ static void
meta_wayland_surface_init (MetaWaylandSurface *surface)
{
surface->pending = g_object_new (META_TYPE_WAYLAND_PENDING_STATE, NULL);
g_signal_connect (surface, "geometry-changed",
G_CALLBACK (meta_wayland_surface_update_outputs_recursively),
NULL);
}
static void
@ -1582,6 +1587,13 @@ meta_wayland_surface_class_init (MetaWaylandSurfaceClass *klass)
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
surface_signals[SURFACE_GEOMETRY_CHANGED] =
g_signal_new ("geometry-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
@ -1795,3 +1807,9 @@ meta_wayland_surface_get_actor (MetaWaylandSurface *surface)
{
return surface->surface_actor;
}
void
meta_wayland_surface_notify_geometry_changed (MetaWaylandSurface *surface)
{
g_signal_emit (surface, surface_signals[SURFACE_GEOMETRY_CHANGED], 0);
}

View File

@ -305,4 +305,6 @@ gboolean meta_wayland_surface_is_shortcuts_inhibited (MetaWaylandSurf
MetaSurfaceActor * meta_wayland_surface_get_actor (MetaWaylandSurface *surface);
void meta_wayland_surface_notify_geometry_changed (MetaWaylandSurface *surface);
#endif