MetaWaylandSurface: Add 'unmapped' signal

Meant to be used by users of MetaWaylandSurface's that need to know
when the surface was unmapped. So far only emitted by shell surfaces
(surfaces with MetaWindow's).

https://bugzilla.gnome.org/show_bug.cgi?id=769786
This commit is contained in:
Jonas Ådahl 2016-08-18 12:57:17 +08:00
parent f49458ccd9
commit aea706230d

View File

@ -120,6 +120,7 @@ G_DEFINE_TYPE (MetaWaylandSurfaceRoleDND,
enum { enum {
SURFACE_DESTROY, SURFACE_DESTROY,
SURFACE_UNMAPPED,
N_SURFACE_SIGNALS N_SURFACE_SIGNALS
}; };
@ -1100,9 +1101,14 @@ void
meta_wayland_surface_set_window (MetaWaylandSurface *surface, meta_wayland_surface_set_window (MetaWaylandSurface *surface,
MetaWindow *window) MetaWindow *window)
{ {
gboolean was_unmapped = surface->window && !window;
surface->window = window; surface->window = window;
sync_reactive (surface); sync_reactive (surface);
sync_drag_dest_funcs (surface); sync_drag_dest_funcs (surface);
if (was_unmapped)
g_signal_emit (surface, surface_signals[SURFACE_UNMAPPED], 0);
} }
static void static void
@ -1855,6 +1861,14 @@ meta_wayland_surface_class_init (MetaWaylandSurfaceClass *klass)
0, NULL, NULL, 0, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
surface_signals[SURFACE_UNMAPPED] =
g_signal_new ("unmapped",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
} }
static void static void