diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c index caaa5148c..f03046ff2 100644 --- a/clutter/clutter/clutter-backend.c +++ b/clutter/clutter/clutter-backend.c @@ -254,7 +254,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend, /* the display owns the renderer and the swap chain */ cogl_object_unref (backend->cogl_renderer); - cogl_object_unref (swap_chain); + g_object_unref (swap_chain); return TRUE; @@ -272,7 +272,7 @@ error: } if (swap_chain != NULL) - cogl_object_unref (swap_chain); + g_object_unref (swap_chain); return FALSE; } diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c index a8bf473c0..f607dd30f 100644 --- a/cogl/cogl/cogl-framebuffer.c +++ b/cogl/cogl/cogl-framebuffer.c @@ -323,7 +323,7 @@ cogl_framebuffer_init_config (CoglFramebuffer *framebuffer, cogl_framebuffer_get_instance_private (framebuffer); priv->config = *config; - cogl_object_ref (priv->config.swap_chain); + g_object_ref (priv->config.swap_chain); } static void diff --git a/cogl/cogl/cogl-onscreen-template.c b/cogl/cogl/cogl-onscreen-template.c index 040ab75ed..80c884714 100644 --- a/cogl/cogl/cogl-onscreen-template.c +++ b/cogl/cogl/cogl-onscreen-template.c @@ -58,7 +58,7 @@ cogl_onscreen_template_new (CoglSwapChain *swap_chain) onscreen_template->config.swap_chain = swap_chain; if (swap_chain) - cogl_object_ref (swap_chain); + g_object_ref (swap_chain); else onscreen_template->config.swap_chain = cogl_swap_chain_new (); diff --git a/cogl/cogl/cogl-swap-chain-private.h b/cogl/cogl/cogl-swap-chain-private.h index 2849e50d8..0c34fe669 100644 --- a/cogl/cogl/cogl-swap-chain-private.h +++ b/cogl/cogl/cogl-swap-chain-private.h @@ -30,11 +30,11 @@ #pragma once -#include "cogl/cogl-object-private.h" +#include struct _CoglSwapChain { - CoglObject _parent; + GObject parent_instance; int length; }; diff --git a/cogl/cogl/cogl-swap-chain.c b/cogl/cogl/cogl-swap-chain.c index 50ee936ef..a2fa15526 100644 --- a/cogl/cogl/cogl-swap-chain.c +++ b/cogl/cogl/cogl-swap-chain.c @@ -31,32 +31,29 @@ #include "cogl-config.h" -#include "cogl/cogl-object.h" - #include "cogl/cogl-swap-chain-private.h" #include "cogl/cogl-swap-chain.h" -#include "cogl/cogl-gtype-private.h" - -static void _cogl_swap_chain_free (CoglSwapChain *swap_chain); - -COGL_OBJECT_DEFINE (SwapChain, swap_chain); -COGL_GTYPE_DEFINE_CLASS (SwapChain, swap_chain); +G_DEFINE_TYPE (CoglSwapChain, cogl_swap_chain, G_TYPE_OBJECT); static void -_cogl_swap_chain_free (CoglSwapChain *swap_chain) +cogl_swap_chain_init (CoglSwapChain *swap_chain) +{ +} + +static void +cogl_swap_chain_class_init (CoglSwapChainClass *class) { - g_free (swap_chain); } CoglSwapChain * cogl_swap_chain_new (void) { - CoglSwapChain *swap_chain = g_new0 (CoglSwapChain, 1); + CoglSwapChain *swap_chain = g_object_new (COGL_TYPE_SWAP_CHAIN, NULL); swap_chain->length = -1; /* no preference */ - return _cogl_swap_chain_object_new (swap_chain); + return swap_chain; } void diff --git a/cogl/cogl/cogl-swap-chain.h b/cogl/cogl/cogl-swap-chain.h index dad43e880..ecd084579 100644 --- a/cogl/cogl/cogl-swap-chain.h +++ b/cogl/cogl/cogl-swap-chain.h @@ -40,13 +40,12 @@ G_BEGIN_DECLS typedef struct _CoglSwapChain CoglSwapChain; -/** - * cogl_swap_chain_get_gtype: - * - * Returns: a #GType that can be used with the GLib type system. - */ +#define COGL_TYPE_SWAP_CHAIN (cogl_swap_chain_get_type ()) + COGL_EXPORT -GType cogl_swap_chain_get_gtype (void); +G_DECLARE_FINAL_TYPE (CoglSwapChain, cogl_swap_chain, + COGL, SWAP_CHAIN, GObject) + COGL_EXPORT CoglSwapChain * cogl_swap_chain_new (void); @@ -59,7 +58,4 @@ COGL_EXPORT void cogl_swap_chain_set_length (CoglSwapChain *swap_chain, int length); -COGL_EXPORT gboolean -cogl_is_swap_chain (void *object); - G_END_DECLS