mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 21:02:14 +00:00
laters: Turn into GObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
This commit is contained in:
parent
4b3cab2cca
commit
7a62e55c54
@ -1308,7 +1308,7 @@ meta_compositor_dispose (GObject *object)
|
||||
meta_compositor_get_instance_private (compositor);
|
||||
ClutterActor *stage = meta_backend_get_stage (priv->backend);
|
||||
|
||||
g_clear_pointer (&priv->laters, meta_laters_free);
|
||||
g_clear_object (&priv->laters);
|
||||
|
||||
g_clear_signal_handler (&priv->stage_presented_id, stage);
|
||||
g_clear_signal_handler (&priv->before_paint_handler_id, stage);
|
||||
|
@ -46,6 +46,8 @@ typedef struct _MetaLater
|
||||
|
||||
struct _MetaLaters
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
MetaCompositor *compositor;
|
||||
|
||||
unsigned int last_later_id;
|
||||
@ -55,6 +57,8 @@ struct _MetaLaters
|
||||
gulong before_update_handler_id;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaLaters, meta_laters, G_TYPE_OBJECT)
|
||||
|
||||
static MetaLater *
|
||||
meta_later_ref (MetaLater *later)
|
||||
{
|
||||
@ -210,6 +214,35 @@ invoke_later_idle (gpointer data)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_laters_finalize (GObject *object)
|
||||
{
|
||||
MetaLaters *laters = META_LATERS (object);
|
||||
|
||||
ClutterStage *stage = meta_compositor_get_stage (laters->compositor);
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (laters->laters); i++)
|
||||
g_slist_free_full (laters->laters[i], (GDestroyNotify) meta_later_unref);
|
||||
|
||||
g_clear_signal_handler (&laters->before_update_handler_id, stage);
|
||||
|
||||
G_OBJECT_CLASS (meta_laters_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_laters_class_init (MetaLatersClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = meta_laters_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_laters_init (MetaLaters *laters)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_laters_add:
|
||||
* @laters: a #MetaLaters
|
||||
@ -355,7 +388,7 @@ meta_laters_new (MetaCompositor *compositor)
|
||||
ClutterStage *stage = meta_compositor_get_stage (compositor);
|
||||
MetaLaters *laters;
|
||||
|
||||
laters = g_new0 (MetaLaters, 1);
|
||||
laters = g_object_new (META_TYPE_LATERS, NULL);
|
||||
laters->compositor = compositor;
|
||||
|
||||
laters->before_update_handler_id =
|
||||
@ -365,16 +398,3 @@ meta_laters_new (MetaCompositor *compositor)
|
||||
|
||||
return laters;
|
||||
}
|
||||
|
||||
void
|
||||
meta_laters_free (MetaLaters *laters)
|
||||
{
|
||||
ClutterStage *stage = meta_compositor_get_stage (laters->compositor);
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (laters->laters); i++)
|
||||
g_slist_free_full (laters->laters[i], (GDestroyNotify) meta_later_unref);
|
||||
|
||||
g_clear_signal_handler (&laters->before_update_handler_id, stage);
|
||||
g_free (laters);
|
||||
}
|
||||
|
@ -43,6 +43,10 @@ typedef enum
|
||||
META_LATER_IDLE
|
||||
} MetaLaterType;
|
||||
|
||||
#define META_TYPE_LATERS (meta_laters_get_type ())
|
||||
META_EXPORT
|
||||
G_DECLARE_FINAL_TYPE (MetaLaters, meta_laters, META, LATERS, GObject)
|
||||
|
||||
META_EXPORT
|
||||
guint meta_later_add (MetaLaterType when,
|
||||
GSourceFunc func,
|
||||
|
Loading…
Reference in New Issue
Block a user