コード例 #1
0
ファイル: ppg-animation.c プロジェクト: chergert/perfkit
/**
 * ppg_animation_tick:
 * @animation: (in): A #PpgAnimation.
 *
 * Moves the object properties to the next position in the animation.
 *
 * Returns: %TRUE if the animation has not completed; otherwise %FALSE.
 * Side effects: None.
 */
static gboolean
ppg_animation_tick (PpgAnimation *animation)
{
	PpgAnimationPrivate *priv;
	GdkWindow *window;
	gdouble offset;
	gdouble alpha;
	GValue value = { 0 };
	Tween *tween;
	gint i;

	g_return_val_if_fail(PPG_IS_ANIMATION(animation), FALSE);

	priv = animation->priv;

	priv->frame_count++;
	offset = ppg_animation_get_offset(animation);
	alpha = alpha_funcs[priv->mode](offset);

	/*
	 * Update property values.
	 */
	for (i = 0; i < priv->tweens->len; i++) {
		tween = &g_array_index(priv->tweens, Tween, i);
		g_value_init(&value, tween->pspec->value_type);
		ppg_animation_get_value_at_offset(animation, alpha, tween, &value);
		if (!tween->is_child) {
			ppg_animation_update_property(animation, priv->target,
			                              tween, &value);
		} else {
			ppg_animation_update_child_property(animation, priv->target,
			                                    tween, &value);
		}
		g_value_unset(&value);
	}

	/*
	 * Notify anyone interested in the tick signal.
	 */
	g_signal_emit(animation, signals[TICK], 0);

	/*
	 * Flush any outstanding events to the graphics server (in the case of X).
	 */
	if (GTK_IS_WIDGET(priv->target)) {
		if ((window = gtk_widget_get_window(GTK_WIDGET(priv->target)))) {
			gdk_window_flush(window);
		}
	}

	return (offset < 1.0);
}
コード例 #2
0
ファイル: tray.c プロジェクト: electricface/dde
PRIVATE void accumulate_na_width(GdkWindow* wrapper, gpointer width)
{
    g_assert(wrapper != _deepin_tray && wrapper != _fcitx_tray);
    int icon_width = gdk_window_get_width(wrapper);
    _na_width += icon_width + 2 * DEFAULT_INTERVAL;
    gdk_window_flush(wrapper);
    gint _na_base_x = gdk_screen_width() - _na_width - DEFAULT_INTERVAL;
    if (icon_width != GPOINTER_TO_INT(width))
        safe_window_move_resize(wrapper, _na_base_x, NA_BASE_Y, GPOINTER_TO_INT(width), DEFAULT_HEIGHT);
    else {
        safe_window_move(wrapper, _na_base_x, NA_BASE_Y);
    }
}