mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
scroll-actor: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
This commit is contained in:
parent
fbef2afb37
commit
9409604820
@ -30,7 +30,6 @@
|
|||||||
#ifndef __GI_SCANNER__
|
#ifndef __GI_SCANNER__
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScrollActor, g_object_unref)
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterText, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterText, g_object_unref)
|
||||||
|
|
||||||
#endif /* __GI_SCANNER__ */
|
#endif /* __GI_SCANNER__ */
|
||||||
|
@ -52,14 +52,14 @@
|
|||||||
#include "clutter/clutter-property-transition.h"
|
#include "clutter/clutter-property-transition.h"
|
||||||
#include "clutter/clutter-transition.h"
|
#include "clutter/clutter-transition.h"
|
||||||
|
|
||||||
struct _ClutterScrollActorPrivate
|
typedef struct _ClutterScrollActorPrivate
|
||||||
{
|
{
|
||||||
graphene_point_t scroll_to;
|
graphene_point_t scroll_to;
|
||||||
|
|
||||||
ClutterScrollMode scroll_mode;
|
ClutterScrollMode scroll_mode;
|
||||||
|
|
||||||
ClutterTransition *transition;
|
ClutterTransition *transition;
|
||||||
};
|
} ClutterScrollActorPrivate;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -95,7 +95,8 @@ static void
|
|||||||
clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
|
clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
|
||||||
const graphene_point_t *point)
|
const graphene_point_t *point)
|
||||||
{
|
{
|
||||||
ClutterScrollActorPrivate *priv = self->priv;
|
ClutterScrollActorPrivate *priv =
|
||||||
|
clutter_scroll_actor_get_instance_private (self);
|
||||||
ClutterActor *actor = CLUTTER_ACTOR (self);
|
ClutterActor *actor = CLUTTER_ACTOR (self);
|
||||||
graphene_matrix_t m;
|
graphene_matrix_t m;
|
||||||
float dx, dy;
|
float dx, dy;
|
||||||
@ -149,11 +150,13 @@ clutter_scroll_actor_get_property (GObject *gobject,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterScrollActor *actor = CLUTTER_SCROLL_ACTOR (gobject);
|
ClutterScrollActor *actor = CLUTTER_SCROLL_ACTOR (gobject);
|
||||||
|
ClutterScrollActorPrivate *priv =
|
||||||
|
clutter_scroll_actor_get_instance_private (actor);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_SCROLL_MODE:
|
case PROP_SCROLL_MODE:
|
||||||
g_value_set_flags (value, actor->priv->scroll_mode);
|
g_value_set_flags (value, priv->scroll_mode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -187,8 +190,10 @@ clutter_scroll_actor_class_init (ClutterScrollActorClass *klass)
|
|||||||
static void
|
static void
|
||||||
clutter_scroll_actor_init (ClutterScrollActor *self)
|
clutter_scroll_actor_init (ClutterScrollActor *self)
|
||||||
{
|
{
|
||||||
self->priv = clutter_scroll_actor_get_instance_private (self);
|
ClutterScrollActorPrivate *priv =
|
||||||
self->priv->scroll_mode = CLUTTER_SCROLL_BOTH;
|
clutter_scroll_actor_get_instance_private (self);
|
||||||
|
|
||||||
|
priv->scroll_mode = CLUTTER_SCROLL_BOTH;
|
||||||
|
|
||||||
clutter_actor_set_clip_to_allocation (CLUTTER_ACTOR (self), TRUE);
|
clutter_actor_set_clip_to_allocation (CLUTTER_ACTOR (self), TRUE);
|
||||||
}
|
}
|
||||||
@ -227,8 +232,10 @@ clutter_scroll_actor_get_initial_state (ClutterAnimatable *animatable,
|
|||||||
if (strcmp (property_name, "scroll-to") == 0)
|
if (strcmp (property_name, "scroll-to") == 0)
|
||||||
{
|
{
|
||||||
ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable);
|
ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable);
|
||||||
|
ClutterScrollActorPrivate *priv =
|
||||||
|
clutter_scroll_actor_get_instance_private (self);
|
||||||
|
|
||||||
g_value_set_boxed (value, &self->priv->scroll_to);
|
g_value_set_boxed (value, &priv->scroll_to);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
parent_animatable_iface->get_initial_state (animatable, property_name, value);
|
parent_animatable_iface->get_initial_state (animatable, property_name, value);
|
||||||
@ -280,8 +287,7 @@ clutter_scroll_actor_set_scroll_mode (ClutterScrollActor *actor,
|
|||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
|
g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
|
||||||
|
|
||||||
priv = actor->priv;
|
priv = clutter_scroll_actor_get_instance_private (actor);
|
||||||
|
|
||||||
if (priv->scroll_mode == mode)
|
if (priv->scroll_mode == mode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -301,9 +307,12 @@ clutter_scroll_actor_set_scroll_mode (ClutterScrollActor *actor,
|
|||||||
ClutterScrollMode
|
ClutterScrollMode
|
||||||
clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
|
clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
|
||||||
{
|
{
|
||||||
|
ClutterScrollActorPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor), CLUTTER_SCROLL_NONE);
|
g_return_val_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor), CLUTTER_SCROLL_NONE);
|
||||||
|
|
||||||
return actor->priv->scroll_mode;
|
priv = clutter_scroll_actor_get_instance_private (actor);
|
||||||
|
return priv->scroll_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -329,7 +338,7 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
|
|||||||
g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
|
g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
|
||||||
g_return_if_fail (point != NULL);
|
g_return_if_fail (point != NULL);
|
||||||
|
|
||||||
priv = actor->priv;
|
priv = clutter_scroll_actor_get_instance_private (actor);
|
||||||
|
|
||||||
info = _clutter_actor_get_animation_info (CLUTTER_ACTOR (actor));
|
info = _clutter_actor_get_animation_info (CLUTTER_ACTOR (actor));
|
||||||
|
|
||||||
|
@ -31,22 +31,6 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_SCROLL_ACTOR (clutter_scroll_actor_get_type ())
|
#define CLUTTER_TYPE_SCROLL_ACTOR (clutter_scroll_actor_get_type ())
|
||||||
#define CLUTTER_SCROLL_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SCROLL_ACTOR, ClutterScrollActor))
|
|
||||||
#define CLUTTER_IS_SCROLL_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCROLL_ACTOR))
|
|
||||||
#define CLUTTER_SCROLL_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SCROLL_ACTOR, ClutterScrollActorClass))
|
|
||||||
#define CLUTTER_IS_SCROLL_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SCROLL_ACTOR))
|
|
||||||
#define CLUTTER_SCROLL_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SCROLL_ACTOR, ClutterScrollActorClass))
|
|
||||||
|
|
||||||
typedef struct _ClutterScrollActorPrivate ClutterScrollActorPrivate;
|
|
||||||
typedef struct _ClutterScrollActorClass ClutterScrollActorClass;
|
|
||||||
|
|
||||||
struct _ClutterScrollActor
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterActor parent_instance;
|
|
||||||
|
|
||||||
ClutterScrollActorPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterScrollActorClass:
|
* ClutterScrollActorClass:
|
||||||
@ -61,7 +45,10 @@ struct _ClutterScrollActorClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
GType clutter_scroll_actor_get_type (void) G_GNUC_CONST;
|
G_DECLARE_DERIVABLE_TYPE (ClutterScrollActor,
|
||||||
|
clutter_scroll_actor,
|
||||||
|
CLUTTER, SCROLL_ACTOR,
|
||||||
|
ClutterActor)
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterActor * clutter_scroll_actor_new (void);
|
ClutterActor * clutter_scroll_actor_new (void);
|
||||||
|
Loading…
Reference in New Issue
Block a user