fixed-layout: Use macros for subclassing boilerplate

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
This commit is contained in:
Bilal Elmoussaoui 2023-11-11 10:58:02 +01:00
parent 23d9210806
commit 5b527ac89b
3 changed files with 12 additions and 31 deletions

View File

@ -34,7 +34,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)

View File

@ -39,9 +39,14 @@
#include "clutter/clutter-fixed-layout.h" #include "clutter/clutter-fixed-layout.h"
#include "clutter/clutter-private.h" #include "clutter/clutter-private.h"
G_DEFINE_TYPE (ClutterFixedLayout, struct _ClutterFixedLayout
clutter_fixed_layout, {
CLUTTER_TYPE_LAYOUT_MANAGER); ClutterLayoutManager parent_instance;
};
G_DEFINE_FINAL_TYPE (ClutterFixedLayout,
clutter_fixed_layout,
CLUTTER_TYPE_LAYOUT_MANAGER);
static void static void
clutter_fixed_layout_get_preferred_width (ClutterLayoutManager *manager, clutter_fixed_layout_get_preferred_width (ClutterLayoutManager *manager,

View File

@ -33,35 +33,12 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define CLUTTER_TYPE_FIXED_LAYOUT (clutter_fixed_layout_get_type ()) #define CLUTTER_TYPE_FIXED_LAYOUT (clutter_fixed_layout_get_type ())
#define CLUTTER_FIXED_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_FIXED_LAYOUT, ClutterFixedLayout))
#define CLUTTER_IS_FIXED_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_FIXED_LAYOUT))
#define CLUTTER_FIXED_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_FIXED_LAYOUT, ClutterFixedLayoutClass))
#define CLUTTER_IS_FIXED_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_FIXED_LAYOUT))
#define CLUTTER_FIXED_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_FIXED_LAYOUT, ClutterFixedLayoutClass))
typedef struct _ClutterFixedLayout ClutterFixedLayout;
typedef struct _ClutterFixedLayoutClass ClutterFixedLayoutClass;
struct _ClutterFixedLayout
{
/*< private >*/
ClutterLayoutManager parent_instance;
};
/**
* ClutterFixedLayoutClass:
*
* The #ClutterFixedLayoutClass structure contains only private data
* and it should be accessed using the provided API
*/
struct _ClutterFixedLayoutClass
{
/*< private >*/
ClutterLayoutManagerClass parent_class;
};
CLUTTER_EXPORT CLUTTER_EXPORT
GType clutter_fixed_layout_get_type (void) G_GNUC_CONST; G_DECLARE_FINAL_TYPE (ClutterFixedLayout,
clutter_fixed_layout,
CLUTTER, FIXED_LAYOUT,
ClutterLayoutManager)
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterLayoutManager *clutter_fixed_layout_new (void); ClutterLayoutManager *clutter_fixed_layout_new (void);