本文整理汇总了C++中CLUTTER_ACTOR_META函数的典型用法代码示例。如果您正苦于以下问题:C++ CLUTTER_ACTOR_META函数的具体用法?C++ CLUTTER_ACTOR_META怎么用?C++ CLUTTER_ACTOR_META使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CLUTTER_ACTOR_META函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _xfdashboard_drag_action_sort_targets_callback
/* Sort drop action targets */
static gint _xfdashboard_drag_action_sort_targets_callback(gconstpointer inLeft, gconstpointer inRight)
{
ClutterActor *actor1, *actor2;
gfloat depth1, depth2;
gfloat x1, y1, w1, h1;
gfloat x2, y2, w2, h2;
ClutterActorBox *box1, *box2;
gint numberPoint1, numberPoint2;
g_return_val_if_fail(XFDASHBOARD_IS_DROP_ACTION(inLeft) && XFDASHBOARD_IS_DROP_ACTION(inRight), 0);
actor1=clutter_actor_meta_get_actor(CLUTTER_ACTOR_META(inLeft));
actor2=clutter_actor_meta_get_actor(CLUTTER_ACTOR_META(inRight));
/* Return -1 if actor in inLeft should be inserted before actor in inRight
* and return 1 if otherwise. If both actors can be handled equal then
* return 0. But how to decide?
* The actor with higher z-depth should be inserted before. If both actors
* have equal z-depth then the actor with the most edge points within the
* other actor (overlap) should be inserted before. Edge points are:
* [left,top], [right,top], [left,bottom] and [right, bottom].
*/
depth1=clutter_actor_get_z_position(actor1);
depth2=clutter_actor_get_z_position(actor2);
if(depth1>depth2) return(-1);
else if(depth1<depth2) return(1);
clutter_actor_get_transformed_position(actor1, &x1, &y1);
clutter_actor_get_transformed_size(actor1, &w1, &h1);
box1=clutter_actor_box_new(x1, y1, x1+w1, y1+h1);
clutter_actor_get_transformed_position(actor2, &x2, &y2);
clutter_actor_get_transformed_size(actor2, &w2, &h2);
box2=clutter_actor_box_new(x2, y2, x2+w2, y2+h2);
numberPoint1 =(clutter_actor_box_contains(box1, x2, y2) ? 1 : 0);
numberPoint1+=(clutter_actor_box_contains(box1, x2+w2, y2) ? 1 : 0);
numberPoint1+=(clutter_actor_box_contains(box1, x2, y2+h2) ? 1 : 0);
numberPoint1+=(clutter_actor_box_contains(box1, x2+w2, y2+h2) ? 1 : 0);
numberPoint2 =(clutter_actor_box_contains(box2, x1, y1) ? 1 : 0);
numberPoint2+=(clutter_actor_box_contains(box2, x1+w1, y1) ? 1 : 0);
numberPoint2+=(clutter_actor_box_contains(box2, x1, y1+h1) ? 1 : 0);
numberPoint2+=(clutter_actor_box_contains(box2, x1+w1, y1+h1) ? 1 : 0);
clutter_actor_box_free(box1);
clutter_actor_box_free(box2);
/* Return result */
if(numberPoint1>numberPoint2) return(1);
else if(numberPoint2>numberPoint1) return(-1);
return(0);
}
示例2: _xfdashboard_drag_action_find_drop_traget_at_coord
/* Find drop target at position */
static XfdashboardDropAction* _xfdashboard_drag_action_find_drop_traget_at_coord(XfdashboardDragAction *self,
gfloat inStageX,
gfloat inStageY)
{
XfdashboardDragActionPrivate *priv;
GSList *list;
g_return_val_if_fail(XFDASHBOARD_IS_DRAG_ACTION(self), NULL);
priv=self->priv;
/* Iterate through list and return first drop target in list
* where coordinates fit in
*/
for(list=priv->targets; list; list=g_slist_next(list))
{
ClutterActorMeta *actorMeta=CLUTTER_ACTOR_META(list->data);
ClutterActor *actor=clutter_actor_meta_get_actor(actorMeta);
gfloat x, y, w, h;
/* Get position and size of actor in stage coordinates */
clutter_actor_get_transformed_position(actor, &x, &y);
clutter_actor_get_transformed_size(actor, &w, &h);
/* If given stage coordinates fit in actor we found it */
if(inStageX>=x && inStageX<(x+w) &&
inStageY>=y && inStageY<(y+h))
{
return(XFDASHBOARD_DROP_ACTION(actorMeta));
}
}
/* If we get here no drop target was found */
return(NULL);
}
示例3: _xfdashboard_tooltip_action_on_leave_event
/* Pointer left actor with tooltip */
static gboolean _xfdashboard_tooltip_action_on_leave_event(XfdashboardTooltipAction *self,
ClutterEvent *inEvent,
gpointer inUserData)
{
XfdashboardTooltipActionPrivate *priv;
ClutterActor *actor;
ClutterActor *stage;
ClutterActor *actorMeta;
g_return_val_if_fail(XFDASHBOARD_IS_TOOLTIP_ACTION(self), CLUTTER_EVENT_PROPAGATE);
g_return_val_if_fail(CLUTTER_IS_ACTOR(inUserData), CLUTTER_EVENT_PROPAGATE);
priv=self->priv;
actor=CLUTTER_ACTOR(inUserData);
/* Get current actor this action belongs to */
actorMeta=clutter_actor_meta_get_actor(CLUTTER_ACTOR_META(self));
/* Release all sources and signal handler (except for enter event) */
if(priv->motionSignalID!=0)
{
if(actorMeta) g_signal_handler_disconnect(actorMeta, priv->motionSignalID);
priv->motionSignalID=0;
}
if(priv->leaveSignalID!=0)
{
if(actorMeta) g_signal_handler_disconnect(actorMeta, priv->leaveSignalID);
priv->leaveSignalID=0;
}
if(priv->captureSignalID)
{
if(priv->captureSignalActor) g_signal_handler_disconnect(priv->captureSignalActor, priv->captureSignalID);
priv->captureSignalActor=NULL;
priv->captureSignalID=0;
}
if(priv->timeoutSourceID!=0)
{
g_source_remove(priv->timeoutSourceID);
priv->timeoutSourceID=0;
}
/* Clear last actor we remembered if it is pointing to this actor */
if(_xfdashboard_tooltip_last_event_actor==actor)
{
_xfdashboard_tooltip_last_event_actor=NULL;
}
/* Hide tooltip now */
stage=clutter_actor_get_stage(actor);
if(stage && XFDASHBOARD_IS_STAGE(stage))
{
g_signal_emit_by_name(stage, "hide-tooltip", self, NULL);
priv->isVisible=FALSE;
}
return(CLUTTER_EVENT_PROPAGATE);
}
示例4: mx_fade_effect_pre_paint
static gboolean
mx_fade_effect_pre_paint (ClutterEffect *effect)
{
MxFadeEffectPrivate *priv = MX_FADE_EFFECT (effect)->priv;
if (!priv->freeze_update)
{
return CLUTTER_EFFECT_CLASS (mx_fade_effect_parent_class)->
pre_paint (effect);
}
else
{
ClutterActorBox box;
ClutterActor *actor =
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
/* Store the stage coordinates of the actor for when we post-paint */
clutter_actor_get_paint_box (actor, &box);
clutter_actor_box_get_origin (&box, &priv->x_offset, &priv->y_offset);
/* Connect to the paint signal so we can block it */
priv->blocked_id =
g_signal_connect (actor, "paint",
G_CALLBACK (mx_fade_effect_paint_cb), effect);
return TRUE;
}
}
示例5: _xfdashboard_click_action_emit_long_press
/* Emit "long-press" signal */
static gboolean _xfdashboard_click_action_emit_long_press(gpointer inUserData)
{
XfdashboardClickAction *self;
XfdashboardClickActionPrivate *priv;
ClutterActor *actor;
gboolean result;
g_return_val_if_fail(XFDASHBOARD_IS_CLICK_ACTION(inUserData), FALSE);
self=XFDASHBOARD_CLICK_ACTION(inUserData);
priv=self->priv;
/* Reset variables */
priv->longPressID=0;
/* Emit signal */
actor=clutter_actor_meta_get_actor(CLUTTER_ACTOR_META(inUserData));
g_signal_emit(self, XfdashboardClickActionSignals[SIGNAL_LONG_PRESS], 0, actor, CLUTTER_LONG_PRESS_ACTIVATE, &result);
/* Disconnect signal handlers */
if(priv->captureID!=0)
{
g_signal_handler_disconnect(priv->stage, priv->captureID);
priv->captureID=0;
}
/* Reset state of this action */
_xfdashboard_click_action_set_pressed(self, FALSE);
_xfdashboard_click_action_set_held(self, FALSE);
/* Event handled */
return(FALSE);
}
示例6: _xfdashboard_click_action_set_pressed
/* Set press state */
static void _xfdashboard_click_action_set_pressed(XfdashboardClickAction *self, gboolean isPressed)
{
XfdashboardClickActionPrivate *priv;
ClutterActor *actor;
g_return_if_fail(XFDASHBOARD_IS_CLICK_ACTION(self));
priv=self->priv;
/* Set value if changed */
isPressed=!!isPressed;
if(priv->isPressed!=isPressed)
{
/* Set value */
priv->isPressed=isPressed;
/* Style state */
actor=clutter_actor_meta_get_actor(CLUTTER_ACTOR_META(self));
if(XFDASHBOARD_IS_ACTOR(actor))
{
if(priv->isPressed) xfdashboard_stylable_add_pseudo_class(XFDASHBOARD_STYLABLE(actor), "pressed");
else xfdashboard_stylable_remove_pseudo_class(XFDASHBOARD_STYLABLE(actor), "pressed");
}
/* Notify about property change */
g_object_notify_by_pspec(G_OBJECT(self), XfdashboardClickActionProperties[PROP_PRESSED]);
}
}
示例7: mx_fade_effect_post_paint
static void
mx_fade_effect_post_paint (ClutterEffect *effect)
{
MxFadeEffectPrivate *priv = MX_FADE_EFFECT (effect)->priv;
if (!priv->freeze_update)
CLUTTER_EFFECT_CLASS (mx_fade_effect_parent_class)->post_paint (effect);
else
{
CoglMatrix modelview;
ClutterActor *actor, *stage;
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
stage = clutter_actor_get_stage (actor);
/* Set up the draw matrix so we draw the offscreen texture at the
* absolute coordinates of the actor-box. We need to do this to
* avoid transforming by the actor matrix twice, as when it's drawn
* into the offscreen surface, it'll already be transformed.
*/
cogl_push_matrix ();
cogl_matrix_init_identity (&modelview);
CLUTTER_ACTOR_CLASS (G_OBJECT_GET_CLASS (stage))->
apply_transform (stage, &modelview);
cogl_matrix_translate (&modelview, priv->x_offset, priv->y_offset, 0.f);
cogl_set_modelview_matrix (&modelview);
clutter_offscreen_effect_paint_target (CLUTTER_OFFSCREEN_EFFECT (effect));
cogl_pop_matrix ();
}
}
示例8: _xfdashboard_click_action_query_long_press
/* Query if long-press events should be handled and signals emitted */
static void _xfdashboard_click_action_query_long_press(XfdashboardClickAction *self)
{
XfdashboardClickActionPrivate *priv;
ClutterActor *actor;
gboolean result;
gint timeout;
g_return_if_fail(XFDASHBOARD_IS_CLICK_ACTION(self));
priv=self->priv;
result=FALSE;
/* If no duration was set get default one from settings */
if(priv->longPressDuration<0)
{
ClutterSettings *settings=clutter_settings_get_default();
g_object_get(settings, "long-press-duration", &timeout, NULL);
}
else timeout=priv->longPressDuration;
/* Emit signal to determine if long-press should be supported */
actor=clutter_actor_meta_get_actor(CLUTTER_ACTOR_META(self));
g_signal_emit(self, XfdashboardClickActionSignals[SIGNAL_LONG_PRESS], 0, actor, CLUTTER_LONG_PRESS_QUERY, &result);
if(result)
{
priv->longPressID=clutter_threads_add_timeout(timeout,
_xfdashboard_click_action_emit_long_press,
self);
}
}
示例9: clutter_actor_meta_get_property
static void
clutter_actor_meta_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
switch (prop_id)
{
case PROP_ACTOR:
g_value_set_object (value, meta->priv->actor);
break;
case PROP_NAME:
g_value_set_string (value, meta->priv->name);
break;
case PROP_ENABLED:
g_value_set_boolean (value, meta->priv->is_enabled);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
示例10: clutter_drag_action_dispose
static void
clutter_drag_action_dispose (GObject *gobject)
{
ClutterDragActionPrivate *priv = CLUTTER_DRAG_ACTION (gobject)->priv;
if (priv->capture_id != 0)
{
if (priv->stage != NULL)
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
priv->stage = NULL;
}
if (priv->button_press_id != 0)
{
ClutterActor *actor;
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject));
g_signal_handler_disconnect (actor, priv->button_press_id);
priv->button_press_id = 0;
}
G_OBJECT_CLASS (clutter_drag_action_parent_class)->dispose (gobject);
}
示例11: click_action_query_long_press
static inline void
click_action_query_long_press (ClutterClickAction *action)
{
ClutterClickActionPrivate *priv = action->priv;
ClutterActor *actor;
gboolean result = FALSE;
gint timeout;
if (priv->long_press_duration < 0)
{
ClutterSettings *settings = clutter_settings_get_default ();
g_object_get (settings,
"long-press-duration", &timeout,
NULL);
}
else
timeout = priv->long_press_duration;
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
g_signal_emit (action, click_signals[LONG_PRESS], 0,
actor,
CLUTTER_LONG_PRESS_QUERY,
&result);
if (result)
{
priv->long_press_id =
clutter_threads_add_timeout (timeout,
click_action_emit_long_press,
action);
}
}
示例12: shader_paint
static void
shader_paint (ClutterEffect *effect,
ClutterEffectPaintFlags flags)
{
ClutterShaderEffect *shader = CLUTTER_SHADER_EFFECT (effect);
float tex_width;
ClutterActor *actor =
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
if (g_test_verbose ())
g_debug ("shader_paint");
clutter_shader_effect_set_shader_source (shader,
"uniform sampler2D tex;\n"
"uniform float step;\n"
"void main (void)\n"
"{\n"
" gl_FragColor = texture2D(tex, vec2 (gl_TexCoord[0].s + step,\n"
" gl_TexCoord[0].t));\n"
"}\n");
tex_width = clutter_actor_get_width (actor);
clutter_shader_effect_set_uniform (shader, "tex", G_TYPE_INT, 1, 0);
clutter_shader_effect_set_uniform (shader, "step", G_TYPE_FLOAT, 1,
SHIFT_STEP / tex_width);
CLUTTER_EFFECT_CLASS (shift_effect_parent_class)->paint (effect, flags);
}
示例13: empathy_rounded_effect_paint
static void
empathy_rounded_effect_paint (ClutterEffect *effect,
ClutterEffectPaintFlags flags)
{
EmpathyRoundedEffect *self = EMPATHY_ROUNDED_EFFECT (effect);
ClutterActor *actor;
ClutterActorBox allocation = { 0, };
gfloat width, height;
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self));
clutter_actor_get_allocation_box (actor, &allocation);
clutter_actor_box_get_size (&allocation, &width, &height);
cogl_path_new ();
/* Create and store a path describing a rounded rectangle. The small
* size of the preview window makes the radius of the rounded corners
* very small too, so we can safely use a very coarse angle step
* without loosing rendering accuracy. It also significantly reduces
* the time spent in the underlying internal cogl path functions */
cogl_path_round_rectangle (0, 0, width, height, height / 16., 15);
cogl_clip_push_from_path ();
/* Flip */
cogl_push_matrix ();
cogl_translate (width, 0, 0);
cogl_scale (-1, 1, 1);
clutter_actor_continue_paint (actor);
cogl_pop_matrix ();
cogl_clip_pop ();
}
示例14: clutter_click_action_dispose
static void
clutter_click_action_dispose (GObject *gobject)
{
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
if (priv->event_id)
{
g_signal_handler_disconnect (clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)),
priv->event_id);
priv->event_id = 0;
}
if (priv->capture_id)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
if (priv->long_press_id)
{
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
}
G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject);
}
示例15: mx_label_fade_started_cb
static void
mx_label_fade_started_cb (ClutterTimeline *timeline,
MxLabel *label)
{
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (label->priv->fade_effect),
TRUE);
}