mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
Add ::window-added and ::window-removed signals to MetaWorkspace
Add sigals to MetaWorkspace to allow tracking when windows are added and removed. Note that on window creation that these signals are fired before the window setup is totally complete, so they need to be used with some care. (For example, the compositor, if present, has not been notified of the new window.) http://bugzilla.gnome.org/show_bug.cgi?id=580025
This commit is contained in:
parent
63b1d6642c
commit
6e9803cd9f
@ -53,6 +53,16 @@ static void workspace_free_struts (MetaWorkspace *workspace);
|
||||
|
||||
G_DEFINE_TYPE (MetaWorkspace, meta_workspace, G_TYPE_OBJECT);
|
||||
|
||||
enum
|
||||
{
|
||||
WINDOW_ADDED,
|
||||
WINDOW_REMOVED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals [LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void
|
||||
meta_workspace_finalize (GObject *object)
|
||||
{
|
||||
@ -102,11 +112,27 @@ meta_workspace_class_init (MetaWorkspaceClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
|
||||
object_class->finalize = meta_workspace_finalize;
|
||||
object_class->get_property = meta_workspace_get_property;
|
||||
object_class->set_property = meta_workspace_set_property;
|
||||
|
||||
signals[WINDOW_ADDED] = g_signal_new ("window-added",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
META_TYPE_WINDOW);
|
||||
signals[WINDOW_REMOVED] = g_signal_new ("window-removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
META_TYPE_WINDOW);
|
||||
|
||||
pspec = g_param_spec_uint ("n-windows",
|
||||
"N Windows",
|
||||
"Number of windows",
|
||||
@ -302,6 +328,7 @@ meta_workspace_add_window (MetaWorkspace *workspace,
|
||||
*/
|
||||
meta_window_queue (window, META_QUEUE_CALC_SHOWING|META_QUEUE_MOVE_RESIZE);
|
||||
|
||||
g_signal_emit (workspace, signals[WINDOW_ADDED], 0, window);
|
||||
g_object_notify (G_OBJECT (workspace), "n-windows");
|
||||
}
|
||||
|
||||
@ -350,6 +377,7 @@ meta_workspace_remove_window (MetaWorkspace *workspace,
|
||||
*/
|
||||
meta_window_queue (window, META_QUEUE_CALC_SHOWING|META_QUEUE_MOVE_RESIZE);
|
||||
|
||||
g_signal_emit (workspace, signals[WINDOW_REMOVED], 0, window);
|
||||
g_object_notify (G_OBJECT (workspace), "n-windows");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user