diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2018-04-06 12:35:34 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2018-04-23 21:31:19 +0200 |
commit | b12c92e206398f200faa58b5dc928be8342c2561 (patch) | |
tree | 7cff6b1cb122841fe0710806ffb3a162f521b1f9 | |
parent | 70036429bd4a0d854caad8b0d0f76f0a5e9b3917 (diff) | |
download | mutter-b12c92e206398f200faa58b5dc928be8342c2561.tar.gz |
wayland: Add MetaWaylandSurface::geometry-changed signal
Abstract this instead of having callers connect to notify:: signals
on the surface actor.
-rw-r--r-- | src/wayland/meta-pointer-confinement-wayland.c | 22 | ||||
-rw-r--r-- | src/wayland/meta-wayland-surface.c | 24 | ||||
-rw-r--r-- | src/wayland/meta-wayland-surface.h | 2 |
3 files changed, 27 insertions, 21 deletions
diff --git a/src/wayland/meta-pointer-confinement-wayland.c b/src/wayland/meta-pointer-confinement-wayland.c index 01a2b7ff8..1e95c1f0d 100644 --- a/src/wayland/meta-pointer-confinement-wayland.c +++ b/src/wayland/meta-pointer-confinement-wayland.c @@ -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) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index fe7f59d78..41ad8bc2b 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -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); +} diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h index ec0b011ac..92ce1050a 100644 --- a/src/wayland/meta-wayland-surface.h +++ b/src/wayland/meta-wayland-surface.h @@ -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 |