diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c index f03046ff2..8a826888a 100644 --- a/clutter/clutter/clutter-backend.c +++ b/clutter/clutter/clutter-backend.c @@ -237,7 +237,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend, backend->cogl_display = cogl_display_new (backend->cogl_renderer, tmpl); /* the display owns the template */ - cogl_object_unref (tmpl); + g_object_unref (tmpl); } if (backend->cogl_display == NULL) diff --git a/cogl/cogl/cogl-display.c b/cogl/cogl/cogl-display.c index f2f2c3ab4..dd985f57b 100644 --- a/cogl/cogl/cogl-display.c +++ b/cogl/cogl/cogl-display.c @@ -70,7 +70,7 @@ cogl_display_dispose (GObject *object) if (display->onscreen_template) { - cogl_object_unref (display->onscreen_template); + g_object_unref (display->onscreen_template); display->onscreen_template = NULL; } @@ -128,10 +128,10 @@ cogl_display_set_onscreen_template (CoglDisplay *display, g_return_if_fail (display->setup == FALSE); if (onscreen_template) - cogl_object_ref (onscreen_template); + g_object_ref (onscreen_template); if (display->onscreen_template) - cogl_object_unref (display->onscreen_template); + g_object_unref (display->onscreen_template); display->onscreen_template = onscreen_template; diff --git a/cogl/cogl/cogl-onscreen-template-private.h b/cogl/cogl/cogl-onscreen-template-private.h index 409cab011..466eb9fa2 100644 --- a/cogl/cogl/cogl-onscreen-template-private.h +++ b/cogl/cogl/cogl-onscreen-template-private.h @@ -30,13 +30,12 @@ #pragma once -#include "cogl/cogl-object-private.h" #include "cogl/cogl-swap-chain.h" #include "cogl/cogl-framebuffer-private.h" struct _CoglOnscreenTemplate { - CoglObject _parent; + GObject parent_instance; CoglFramebufferConfig config; }; diff --git a/cogl/cogl/cogl-onscreen-template.c b/cogl/cogl/cogl-onscreen-template.c index 80c884714..50914f32c 100644 --- a/cogl/cogl/cogl-onscreen-template.c +++ b/cogl/cogl/cogl-onscreen-template.c @@ -31,29 +31,27 @@ #include "cogl-config.h" -#include "cogl/cogl-object.h" - #include "cogl/cogl-framebuffer-private.h" #include "cogl/cogl-onscreen-template-private.h" -#include "cogl/cogl-gtype-private.h" #include -static void _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template); - -COGL_OBJECT_DEFINE (OnscreenTemplate, onscreen_template); -COGL_GTYPE_DEFINE_CLASS (OnscreenTemplate, onscreen_template); +G_DEFINE_TYPE (CoglOnscreenTemplate, cogl_onscreen_template, G_TYPE_OBJECT); static void -_cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template) +cogl_onscreen_template_init (CoglOnscreenTemplate *onscreen_template) +{ +} + +static void +cogl_onscreen_template_class_init (CoglOnscreenTemplateClass *class) { - g_free (onscreen_template); } CoglOnscreenTemplate * cogl_onscreen_template_new (CoglSwapChain *swap_chain) { - CoglOnscreenTemplate *onscreen_template = g_new0 (CoglOnscreenTemplate, 1); + CoglOnscreenTemplate *onscreen_template = g_object_new (COGL_TYPE_ONSCREEN_TEMPLATE, NULL); char *user_config; onscreen_template->config.swap_chain = swap_chain; @@ -74,7 +72,7 @@ cogl_onscreen_template_new (CoglSwapChain *swap_chain) samples_per_pixel; } - return _cogl_onscreen_template_object_new (onscreen_template); + return onscreen_template; } void diff --git a/cogl/cogl/cogl-onscreen-template.h b/cogl/cogl/cogl-onscreen-template.h index 0299d9108..1d632b8f8 100644 --- a/cogl/cogl/cogl-onscreen-template.h +++ b/cogl/cogl/cogl-onscreen-template.h @@ -42,17 +42,13 @@ G_BEGIN_DECLS -typedef struct _CoglOnscreenTemplate CoglOnscreenTemplate; +typedef struct _CoglOnscreenTemplate CoglOnscreenTemplate; -#define COGL_ONSCREEN_TEMPLATE(OBJECT) ((CoglOnscreenTemplate *)OBJECT) +#define COGL_TYPE_ONSCREEN_TEMPLATE (cogl_onscreen_template_get_type ()) -/** - * cogl_onscreen_template_get_gtype: - * - * Returns: a #GType that can be used with the GLib type system. - */ COGL_EXPORT -GType cogl_onscreen_template_get_gtype (void); +G_DECLARE_FINAL_TYPE (CoglOnscreenTemplate, cogl_onscreen_template, + COGL, ONSCREEN_TEMPLATE, GObject) COGL_EXPORT CoglOnscreenTemplate * cogl_onscreen_template_new (CoglSwapChain *swap_chain); @@ -95,18 +91,7 @@ cogl_onscreen_template_set_samples_per_pixel ( */ COGL_EXPORT void cogl_onscreen_template_set_stereo_enabled ( - CoglOnscreenTemplate *onscreen_template, - gboolean enabled); -/** - * cogl_is_onscreen_template: - * @object: A #CoglObject pointer - * - * Gets whether the given object references a #CoglOnscreenTemplate. - * - * Return value: %TRUE if the object references a #CoglOnscreenTemplate - * and %FALSE otherwise. - */ -COGL_EXPORT gboolean -cogl_is_onscreen_template (void *object); + CoglOnscreenTemplate *onscreen_template, + gboolean enabled); G_END_DECLS diff --git a/src/backends/x11/meta-clutter-backend-x11.c b/src/backends/x11/meta-clutter-backend-x11.c index f60cb95f3..99beaa51a 100644 --- a/src/backends/x11/meta-clutter-backend-x11.c +++ b/src/backends/x11/meta-clutter-backend-x11.c @@ -164,7 +164,7 @@ meta_clutter_backend_x11_get_display (ClutterBackend *clutter_backend, if (res) display = cogl_display_new (renderer, onscreen_template); - cogl_object_unref (onscreen_template); + g_object_unref (onscreen_template); return display; }