mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
clutter: Content: Use G_DECLARE_INTERFACE()
It cuts away a bit of the GObject boilerplate, gives us support for `g_autoptr`, and removes the typedef hack inside clutter-content.c. https://gitlab.gnome.org/GNOME/mutter/merge_requests/380
This commit is contained in:
parent
b67394dcd1
commit
b77e6f0c98
@ -49,7 +49,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContent, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeviceManager, g_object_unref)
|
||||
|
@ -97,7 +97,7 @@ enum
|
||||
|
||||
static guint canvas_signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
static void clutter_content_iface_init (ClutterContentIface *iface);
|
||||
static void clutter_content_iface_init (ClutterContentInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterCanvas, clutter_canvas, G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (ClutterCanvas)
|
||||
@ -457,7 +457,7 @@ clutter_canvas_get_preferred_size (ClutterContent *content,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_content_iface_init (ClutterContentIface *iface)
|
||||
clutter_content_iface_init (ClutterContentInterface *iface)
|
||||
{
|
||||
iface->invalidate = clutter_canvas_invalidate;
|
||||
iface->paint_content = clutter_canvas_paint_content;
|
||||
|
@ -45,8 +45,6 @@
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
typedef struct _ClutterContentIface ClutterContentInterface;
|
||||
|
||||
enum
|
||||
{
|
||||
ATTACHED,
|
||||
@ -130,7 +128,7 @@ clutter_content_default_init (ClutterContentInterface *iface)
|
||||
g_signal_new (I_("attached"),
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (ClutterContentIface, attached),
|
||||
G_STRUCT_OFFSET (ClutterContentInterface, attached),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
@ -150,7 +148,7 @@ clutter_content_default_init (ClutterContentInterface *iface)
|
||||
g_signal_new (I_("detached"),
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (ClutterContentIface, detached),
|
||||
G_STRUCT_OFFSET (ClutterContentInterface, detached),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
@ -245,7 +243,7 @@ clutter_content_invalidate_size (ClutterContent *content)
|
||||
* is associated to a #ClutterContent, to set up a backpointer from
|
||||
* the @content to the @actor.
|
||||
*
|
||||
* This function will invoke the #ClutterContentIface.attached() virtual
|
||||
* This function will invoke the #ClutterContentInterface.attached() virtual
|
||||
* function.
|
||||
*/
|
||||
void
|
||||
@ -279,7 +277,7 @@ _clutter_content_attached (ClutterContent *content,
|
||||
* This function should be used internally every time a #ClutterActor
|
||||
* removes the association with a #ClutterContent.
|
||||
*
|
||||
* This function will invoke the #ClutterContentIface.detached() virtual
|
||||
* This function will invoke the #ClutterContentInterface.detached() virtual
|
||||
* function.
|
||||
*/
|
||||
void
|
||||
@ -308,7 +306,7 @@ _clutter_content_detached (ClutterContent *content,
|
||||
*
|
||||
* Creates the render tree for the @content and @actor.
|
||||
*
|
||||
* This function will invoke the #ClutterContentIface.paint_content()
|
||||
* This function will invoke the #ClutterContentInterface.paint_content()
|
||||
* virtual function.
|
||||
*/
|
||||
void
|
||||
|
@ -33,24 +33,13 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_CONTENT (clutter_content_get_type ())
|
||||
#define CLUTTER_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONTENT, ClutterContent))
|
||||
#define CLUTTER_IS_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONTENT))
|
||||
#define CLUTTER_CONTENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_CONTENT, ClutterContentIface))
|
||||
#define CLUTTER_TYPE_CONTENT (clutter_content_get_type ())
|
||||
|
||||
typedef struct _ClutterContentIface ClutterContentIface;
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_INTERFACE (ClutterContent, clutter_content, CLUTTER, CONTENT, GObject)
|
||||
|
||||
/**
|
||||
* ClutterContent:
|
||||
*
|
||||
* The #ClutterContent structure is an opaque type
|
||||
* whose members cannot be acccessed directly.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterContentIface:
|
||||
* ClutterContentInterface:
|
||||
* @get_preferred_size: virtual function; should be overridden by subclasses
|
||||
* of #ClutterContent that have a natural size
|
||||
* @paint_content: virtual function; called each time the content needs to
|
||||
@ -62,12 +51,12 @@ typedef struct _ClutterContentIface ClutterContentIface;
|
||||
* @invalidate: virtual function; called each time a #ClutterContent state
|
||||
* is changed.
|
||||
*
|
||||
* The #ClutterContentIface structure contains only
|
||||
* The #ClutterContentInterface structure contains only
|
||||
* private data.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
struct _ClutterContentIface
|
||||
struct _ClutterContentInterface
|
||||
{
|
||||
/*< private >*/
|
||||
GTypeInterface g_iface;
|
||||
@ -90,9 +79,6 @@ struct _ClutterContentIface
|
||||
void (* invalidate_size) (ClutterContent *content);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_content_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_content_get_preferred_size (ClutterContent *content,
|
||||
gfloat *width,
|
||||
|
@ -57,7 +57,7 @@ struct _ClutterImagePrivate
|
||||
gint height;
|
||||
};
|
||||
|
||||
static void clutter_content_iface_init (ClutterContentIface *iface);
|
||||
static void clutter_content_iface_init (ClutterContentInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterImage, clutter_image, G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (ClutterImage)
|
||||
@ -154,7 +154,7 @@ clutter_image_get_preferred_size (ClutterContent *content,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_content_iface_init (ClutterContentIface *iface)
|
||||
clutter_content_iface_init (ClutterContentInterface *iface)
|
||||
{
|
||||
iface->get_preferred_size = clutter_image_get_preferred_size;
|
||||
iface->paint_content = clutter_image_paint_content;
|
||||
|
@ -17,7 +17,7 @@ typedef struct _ColorContentClass {
|
||||
GObjectClass parent_class;
|
||||
} ColorContentClass;
|
||||
|
||||
static void clutter_content_iface_init (ClutterContentIface *iface);
|
||||
static void clutter_content_iface_init (ClutterContentInterface *iface);
|
||||
|
||||
GType color_content_get_type (void);
|
||||
|
||||
@ -135,7 +135,7 @@ color_content_paint_content (ClutterContent *content,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_content_iface_init (ClutterContentIface *iface)
|
||||
clutter_content_iface_init (ClutterContentInterface *iface)
|
||||
{
|
||||
iface->paint_content = color_content_paint_content;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ typedef struct _SolidContentClass {
|
||||
GObjectClass parent_class;
|
||||
} SolidContentClass;
|
||||
|
||||
static void clutter_content_iface_init (ClutterContentIface *iface);
|
||||
static void clutter_content_iface_init (ClutterContentInterface *iface);
|
||||
|
||||
GType solid_content_get_type (void);
|
||||
|
||||
@ -136,7 +136,7 @@ solid_content_paint_content (ClutterContent *content,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_content_iface_init (ClutterContentIface *iface)
|
||||
clutter_content_iface_init (ClutterContentInterface *iface)
|
||||
{
|
||||
iface->paint_content = solid_content_paint_content;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user