mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
rotate-action: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
This commit is contained in:
parent
aa8ef78b17
commit
64ad3abded
@ -47,7 +47,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterKeyframeTransition, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterOffscreenEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPageTurnEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPropertyTransition, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRotateAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScrollActor, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterShaderEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterStage, g_object_unref)
|
||||
|
@ -42,12 +42,12 @@
|
||||
#include "clutter/clutter-marshal.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
|
||||
struct _ClutterRotateActionPrivate
|
||||
typedef struct _ClutterRotateActionPrivate
|
||||
{
|
||||
gfloat initial_vector[2];
|
||||
gdouble initial_vector_norm;
|
||||
gdouble initial_rotation;
|
||||
};
|
||||
} ClutterRotateActionPrivate;
|
||||
|
||||
enum
|
||||
{
|
||||
@ -64,7 +64,8 @@ static gboolean
|
||||
clutter_rotate_action_gesture_begin (ClutterGestureAction *action,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterRotateActionPrivate *priv = CLUTTER_ROTATE_ACTION (action)->priv;
|
||||
ClutterRotateActionPrivate *priv =
|
||||
clutter_rotate_action_get_instance_private (CLUTTER_ROTATE_ACTION (action));
|
||||
gfloat p1[2], p2[2];
|
||||
|
||||
/* capture initial vector */
|
||||
@ -87,7 +88,8 @@ static gboolean
|
||||
clutter_rotate_action_gesture_progress (ClutterGestureAction *action,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterRotateActionPrivate *priv = CLUTTER_ROTATE_ACTION (action)->priv;
|
||||
ClutterRotateActionPrivate *priv =
|
||||
clutter_rotate_action_get_instance_private (CLUTTER_ROTATE_ACTION (action));
|
||||
gfloat p1[2], p2[2];
|
||||
gfloat vector[2];
|
||||
gboolean retval;
|
||||
@ -206,12 +208,8 @@ clutter_rotate_action_class_init (ClutterRotateActionClass *klass)
|
||||
static void
|
||||
clutter_rotate_action_init (ClutterRotateAction *self)
|
||||
{
|
||||
ClutterGestureAction *gesture;
|
||||
|
||||
self->priv = clutter_rotate_action_get_instance_private (self);
|
||||
|
||||
gesture = CLUTTER_GESTURE_ACTION (self);
|
||||
clutter_gesture_action_set_n_touch_points (gesture, 2);
|
||||
clutter_gesture_action_set_n_touch_points (CLUTTER_GESTURE_ACTION (self),
|
||||
2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,23 +33,13 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_ROTATE_ACTION (clutter_rotate_action_get_type ())
|
||||
#define CLUTTER_ROTATE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROTATE_ACTION, ClutterRotateAction))
|
||||
#define CLUTTER_IS_ROTATE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROTATE_ACTION))
|
||||
#define CLUTTER_ROTATE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ROTATE_ACTION, ClutterRotateActionClass))
|
||||
#define CLUTTER_IS_ROTATE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ROTATE_ACTION))
|
||||
#define CLUTTER_ROTATE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ROTATE_ACTION, ClutterRotateActionClass))
|
||||
|
||||
typedef struct _ClutterRotateAction ClutterRotateAction;
|
||||
typedef struct _ClutterRotateActionPrivate ClutterRotateActionPrivate;
|
||||
typedef struct _ClutterRotateActionClass ClutterRotateActionClass;
|
||||
|
||||
struct _ClutterRotateAction
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterGestureAction parent_instance;
|
||||
|
||||
ClutterRotateActionPrivate *priv;
|
||||
};
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterRotateAction,
|
||||
clutter_rotate_action,
|
||||
CLUTTER,
|
||||
ROTATE_ACTION,
|
||||
ClutterGestureAction)
|
||||
|
||||
/**
|
||||
* ClutterRotateActionClass:
|
||||
@ -64,9 +54,6 @@ struct _ClutterRotateActionClass
|
||||
ClutterGestureActionClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_rotate_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterAction *clutter_rotate_action_new (void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user