mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
wayland: Add MetaWaylandSurface::destroy signal
There's places where it would be convenient to add listeners to this, so add the signal. The signal is only emitted once during destruction, it is convenient for the places where we want notifications at a time the object is still alive, as opposed to weak refs which notify after the fact.
This commit is contained in:
parent
4c6dae0bae
commit
1acfcbda6c
@ -118,6 +118,13 @@ G_DEFINE_TYPE (MetaWaylandSurfaceRoleDND,
|
||||
meta_wayland_surface_role_dnd,
|
||||
META_TYPE_WAYLAND_SURFACE_ROLE);
|
||||
|
||||
enum {
|
||||
SURFACE_DESTROY,
|
||||
N_SURFACE_SIGNALS
|
||||
};
|
||||
|
||||
guint surface_signals[N_SURFACE_SIGNALS] = { 0 };
|
||||
|
||||
static void
|
||||
meta_wayland_surface_role_assigned (MetaWaylandSurfaceRole *surface_role);
|
||||
|
||||
@ -1795,6 +1802,20 @@ meta_wayland_surface_get_absolute_coordinates (MetaWaylandSurface *surface,
|
||||
*y = v.y;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_wayland_surface_dispose (GObject *object)
|
||||
{
|
||||
MetaWaylandSurface *surface = META_WAYLAND_SURFACE (object);
|
||||
|
||||
if (!surface->destroying)
|
||||
{
|
||||
g_signal_emit (object, surface_signals[SURFACE_DESTROY], 0);
|
||||
surface->destroying = TRUE;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (meta_wayland_surface_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_wayland_surface_init (MetaWaylandSurface *surface)
|
||||
{
|
||||
@ -1804,6 +1825,17 @@ meta_wayland_surface_init (MetaWaylandSurface *surface)
|
||||
static void
|
||||
meta_wayland_surface_class_init (MetaWaylandSurfaceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = meta_wayland_surface_dispose;
|
||||
|
||||
surface_signals[SURFACE_DESTROY] =
|
||||
g_signal_new ("destroy",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -207,6 +207,7 @@ struct _MetaWaylandSurface
|
||||
|
||||
/* gtk_surface stuff */
|
||||
gboolean is_modal;
|
||||
gboolean destroying;
|
||||
|
||||
/* wl_subsurface stuff. */
|
||||
struct {
|
||||
|
Loading…
Reference in New Issue
Block a user