swipe-action: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
This commit is contained in:
parent
1df56ca77a
commit
57fbc304f5
@ -50,7 +50,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPropertyTransition, 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)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSwipeAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterText, g_object_unref)
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
|
||||
|
@ -44,13 +44,13 @@
|
||||
#include "clutter/clutter-marshal.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
|
||||
struct _ClutterSwipeActionPrivate
|
||||
typedef struct _ClutterSwipeActionPrivate
|
||||
{
|
||||
ClutterSwipeDirection h_direction;
|
||||
ClutterSwipeDirection v_direction;
|
||||
|
||||
float distance_x, distance_y;
|
||||
};
|
||||
} ClutterSwipeActionPrivate;
|
||||
|
||||
enum
|
||||
{
|
||||
@ -67,7 +67,8 @@ static gboolean
|
||||
gesture_begin (ClutterGestureAction *action,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterSwipeActionPrivate *priv = CLUTTER_SWIPE_ACTION (action)->priv;
|
||||
ClutterSwipeActionPrivate *priv =
|
||||
clutter_swipe_action_get_instance_private (CLUTTER_SWIPE_ACTION (action));
|
||||
|
||||
/* reset the state at the beginning of a new gesture */
|
||||
priv->h_direction = 0;
|
||||
@ -85,7 +86,8 @@ static gboolean
|
||||
gesture_progress (ClutterGestureAction *action,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterSwipeActionPrivate *priv = CLUTTER_SWIPE_ACTION (action)->priv;
|
||||
ClutterSwipeActionPrivate *priv =
|
||||
clutter_swipe_action_get_instance_private (CLUTTER_SWIPE_ACTION (action));
|
||||
gfloat press_x, press_y;
|
||||
gfloat motion_x, motion_y;
|
||||
gfloat delta_x, delta_y;
|
||||
@ -134,7 +136,8 @@ static void
|
||||
gesture_end (ClutterGestureAction *action,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterSwipeActionPrivate *priv = CLUTTER_SWIPE_ACTION (action)->priv;
|
||||
ClutterSwipeActionPrivate *priv =
|
||||
clutter_swipe_action_get_instance_private (CLUTTER_SWIPE_ACTION (action));
|
||||
gfloat press_x, press_y;
|
||||
gfloat release_x, release_y;
|
||||
ClutterSwipeDirection direction = 0;
|
||||
@ -210,7 +213,6 @@ clutter_swipe_action_class_init (ClutterSwipeActionClass *klass)
|
||||
static void
|
||||
clutter_swipe_action_init (ClutterSwipeAction *self)
|
||||
{
|
||||
self->priv = clutter_swipe_action_get_instance_private (self);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,23 +37,13 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_SWIPE_ACTION (clutter_swipe_action_get_type ())
|
||||
#define CLUTTER_SWIPE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SWIPE_ACTION, ClutterSwipeAction))
|
||||
#define CLUTTER_IS_SWIPE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SWIPE_ACTION))
|
||||
#define CLUTTER_SWIPE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SWIPE_ACTION, ClutterSwipeActionClass))
|
||||
#define CLUTTER_IS_SWIPE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SWIPE_ACTION))
|
||||
#define CLUTTER_SWIPE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SWIPE_ACTION, ClutterSwipeActionClass))
|
||||
|
||||
typedef struct _ClutterSwipeAction ClutterSwipeAction;
|
||||
typedef struct _ClutterSwipeActionPrivate ClutterSwipeActionPrivate;
|
||||
typedef struct _ClutterSwipeActionClass ClutterSwipeActionClass;
|
||||
|
||||
struct _ClutterSwipeAction
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterGestureAction parent_instance;
|
||||
|
||||
ClutterSwipeActionPrivate *priv;
|
||||
};
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterSwipeAction,
|
||||
clutter_swipe_action,
|
||||
CLUTTER,
|
||||
SWIPE_ACTION,
|
||||
ClutterGestureAction)
|
||||
|
||||
/**
|
||||
* ClutterSwipeActionClass:
|
||||
@ -73,9 +63,6 @@ struct _ClutterSwipeActionClass
|
||||
ClutterSwipeDirection direction);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_swipe_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterAction * clutter_swipe_action_new (void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user