swipe-action: Introduce new ::swipe signal
This deprecates the old ::swept signal, which didn't have a handled boolean parameter. https://bugzilla.gnome.org/show_bug.cgi?id=689392
This commit is contained in:
parent
80eeac71f9
commit
184b8c6fa6
@ -4,6 +4,7 @@ BOOLEAN:OBJECT,BOOLEAN
|
|||||||
BOOLEAN:OBJECT,BOXED,DOUBLE
|
BOOLEAN:OBJECT,BOXED,DOUBLE
|
||||||
BOOLEAN:OBJECT,DOUBLE
|
BOOLEAN:OBJECT,DOUBLE
|
||||||
BOOLEAN:OBJECT,ENUM
|
BOOLEAN:OBJECT,ENUM
|
||||||
|
BOOLEAN:OBJECT,FLAGS
|
||||||
BOOLEAN:STRING,UINT,FLAGS
|
BOOLEAN:STRING,UINT,FLAGS
|
||||||
BOOLEAN:OBJECT
|
BOOLEAN:OBJECT
|
||||||
BOOLEAN:OBJECT,FLOAT,FLOAT
|
BOOLEAN:OBJECT,FLOAT,FLOAT
|
||||||
|
@ -59,6 +59,7 @@ struct _ClutterSwipeActionPrivate
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SWEPT,
|
SWEPT,
|
||||||
|
SWIPE,
|
||||||
|
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
@ -141,6 +142,7 @@ gesture_end (ClutterGestureAction *action,
|
|||||||
gfloat press_x, press_y;
|
gfloat press_x, press_y;
|
||||||
gfloat release_x, release_y;
|
gfloat release_x, release_y;
|
||||||
ClutterSwipeDirection direction = 0;
|
ClutterSwipeDirection direction = 0;
|
||||||
|
gboolean can_emit_swipe;
|
||||||
|
|
||||||
clutter_gesture_action_get_press_coords (action,
|
clutter_gesture_action_get_press_coords (action,
|
||||||
0,
|
0,
|
||||||
@ -160,7 +162,11 @@ gesture_end (ClutterGestureAction *action,
|
|||||||
else if (press_y - release_y > priv->threshold)
|
else if (press_y - release_y > priv->threshold)
|
||||||
direction |= CLUTTER_SWIPE_DIRECTION_UP;
|
direction |= CLUTTER_SWIPE_DIRECTION_UP;
|
||||||
|
|
||||||
g_signal_emit (action, swipe_signals[SWEPT], 0, actor, direction);
|
/* XXX:2.0 remove */
|
||||||
|
g_signal_emit (action, swipe_signals[SWIPE], 0, actor, direction,
|
||||||
|
&can_emit_swipe);
|
||||||
|
if (can_emit_swipe)
|
||||||
|
g_signal_emit (action, swipe_signals[SWEPT], 0, actor, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -184,18 +190,46 @@ clutter_swipe_action_class_init (ClutterSwipeActionClass *klass)
|
|||||||
* The ::swept signal is emitted when a swipe gesture is recognized on the
|
* The ::swept signal is emitted when a swipe gesture is recognized on the
|
||||||
* attached actor.
|
* attached actor.
|
||||||
*
|
*
|
||||||
|
* Deprecated: 1.14: Use the ::swipe signal instead.
|
||||||
|
*
|
||||||
* Since: 1.8
|
* Since: 1.8
|
||||||
*/
|
*/
|
||||||
swipe_signals[SWEPT] =
|
swipe_signals[SWEPT] =
|
||||||
g_signal_new (I_("swept"),
|
g_signal_new (I_("swept"),
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST |
|
||||||
|
G_SIGNAL_DEPRECATED,
|
||||||
G_STRUCT_OFFSET (ClutterSwipeActionClass, swept),
|
G_STRUCT_OFFSET (ClutterSwipeActionClass, swept),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
_clutter_marshal_VOID__OBJECT_FLAGS,
|
_clutter_marshal_VOID__OBJECT_FLAGS,
|
||||||
G_TYPE_NONE, 2,
|
G_TYPE_NONE, 2,
|
||||||
CLUTTER_TYPE_ACTOR,
|
CLUTTER_TYPE_ACTOR,
|
||||||
CLUTTER_TYPE_SWIPE_DIRECTION);
|
CLUTTER_TYPE_SWIPE_DIRECTION);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterSwipeAction::swipe:
|
||||||
|
* @action: the #ClutterSwipeAction that emitted the signal
|
||||||
|
* @actor: the #ClutterActor attached to the @action
|
||||||
|
* @direction: the main direction of the swipe gesture
|
||||||
|
*
|
||||||
|
* The ::swipe signal is emitted when a swipe gesture is recognized on the
|
||||||
|
* attached actor.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the swipe should continue, and %FALSE if
|
||||||
|
* the swipe should be cancelled.
|
||||||
|
*
|
||||||
|
* Since: 1.14
|
||||||
|
*/
|
||||||
|
swipe_signals[SWIPE] =
|
||||||
|
g_signal_new (I_("swipe"),
|
||||||
|
G_TYPE_FROM_CLASS (klass),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
G_STRUCT_OFFSET (ClutterSwipeActionClass, swipe),
|
||||||
|
_clutter_boolean_continue_accumulator, NULL,
|
||||||
|
_clutter_marshal_BOOLEAN__OBJECT_FLAGS,
|
||||||
|
G_TYPE_BOOLEAN, 2,
|
||||||
|
CLUTTER_TYPE_ACTOR,
|
||||||
|
CLUTTER_TYPE_SWIPE_DIRECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -83,6 +83,10 @@ struct _ClutterSwipeActionClass
|
|||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
ClutterSwipeDirection direction);
|
ClutterSwipeDirection direction);
|
||||||
|
|
||||||
|
gboolean (* swipe) (ClutterSwipeAction *action,
|
||||||
|
ClutterActor *actor,
|
||||||
|
ClutterSwipeDirection direction);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
void (* _clutter_swipe_action1) (void);
|
void (* _clutter_swipe_action1) (void);
|
||||||
void (* _clutter_swipe_action2) (void);
|
void (* _clutter_swipe_action2) (void);
|
||||||
@ -90,7 +94,6 @@ struct _ClutterSwipeActionClass
|
|||||||
void (* _clutter_swipe_action4) (void);
|
void (* _clutter_swipe_action4) (void);
|
||||||
void (* _clutter_swipe_action5) (void);
|
void (* _clutter_swipe_action5) (void);
|
||||||
void (* _clutter_swipe_action6) (void);
|
void (* _clutter_swipe_action6) (void);
|
||||||
void (* _clutter_swipe_action7) (void);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GType clutter_swipe_action_get_type (void) G_GNUC_CONST;
|
GType clutter_swipe_action_get_type (void) G_GNUC_CONST;
|
||||||
|
Loading…
Reference in New Issue
Block a user