コード例 #1
0
static void
update_wrap_mode_of_actor (MetaBackgroundActor *self)
{
  MetaBackgroundActorPrivate *priv = self->priv;

  meta_background_set_layer_wrap_mode (META_BACKGROUND (priv->top_actor), priv->background->wrap_mode);
  meta_background_set_layer_wrap_mode (META_BACKGROUND (priv->bottom_actor), priv->background->wrap_mode);
}
コード例 #2
0
static void
set_texture_on_actors (MetaBackgroundActor *self)
{
  MetaBackgroundActorPrivate *priv = self->priv;

  meta_background_set_layer (META_BACKGROUND (priv->bottom_actor), priv->background->texture);
  meta_background_set_layer (META_BACKGROUND (priv->top_actor), priv->background->texture);

  clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
}
コード例 #3
0
static void
set_texture_on_actor (MetaBackgroundActor *self)
{
  MetaBackgroundActorPrivate *priv = self->priv;
  MetaBackgroundTransition background_transition;

  if (priv->transition_running)
    cancel_transitions (self);

  background_transition = meta_prefs_get_background_transition();

  if (background_transition == META_BACKGROUND_TRANSITION_NONE)
  {
    // NO TRANSITION
    clutter_actor_set_opacity (CLUTTER_ACTOR (priv->bottom_actor), 0);
    meta_background_set_layer (META_BACKGROUND (priv->top_actor), priv->background->texture);
    on_transition_complete (priv->top_actor, self);
  }
  else
  {
    if (background_transition == META_BACKGROUND_TRANSITION_FADEIN)
    {
      // FADE_IN TRANSITION
      clutter_actor_set_opacity (CLUTTER_ACTOR (priv->bottom_actor), 0);
    }

    // BLEND TRANSITION
    clutter_actor_set_opacity (CLUTTER_ACTOR (priv->top_actor), 0);
    meta_background_set_layer (META_BACKGROUND (priv->top_actor), priv->background->texture);

    priv->transition_running = TRUE;

    clutter_actor_save_easing_state (priv->top_actor);
    clutter_actor_set_easing_duration (priv->top_actor, FADE_DURATION);
    clutter_actor_set_opacity (priv->top_actor, 255);
    clutter_actor_restore_easing_state (priv->top_actor);

    g_signal_connect (priv->top_actor,
                      "transitions-completed",
                      G_CALLBACK (on_transition_complete),
                      self);

    clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
  }
}
コード例 #4
0
static void
on_transition_complete (ClutterActor *actor,
                       gpointer      user_data)
{
  MetaBackgroundActor *self = (MetaBackgroundActor *)user_data;
  MetaBackgroundActorPrivate *priv = self->priv;

  meta_background_set_layer (META_BACKGROUND (priv->bottom_actor), priv->background->texture);
  priv->transition_running = FALSE;
}
コード例 #5
0
static void
cancel_transitions (MetaBackgroundActor *self)
{
  MetaBackgroundActorPrivate *priv = self->priv;

  clutter_actor_remove_all_transitions (priv->top_actor);
  clutter_actor_set_opacity (priv->top_actor, 255);
  meta_background_set_layer (META_BACKGROUND (priv->bottom_actor), priv->background->texture);

  priv->transition_running = FALSE;
}
コード例 #6
0
/**
 * meta_background_actor_set_visible_region:
 * @self: a #MetaBackgroundActor
 * @visible_region: (allow-none): the area of the actor (in allocate-relative
 *   coordinates) that is visible.
 *
 * Sets the area of the background that is unobscured by overlapping windows.
 * This is used to optimize and only paint the visible portions.
 */
LOCAL_SYMBOL void
meta_background_actor_set_visible_region (MetaBackgroundActor *self,
                                          cairo_region_t      *visible_region)
{
  MetaBackgroundActorPrivate *priv;

  g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));

  priv = self->priv;

  if (priv->top_actor != NULL)
    meta_background_set_visible_region (META_BACKGROUND (priv->top_actor), visible_region);
}
コード例 #7
0
static void
meta_background_paint (ClutterActor *actor)
{
  MetaBackground *self = META_BACKGROUND (actor);
  MetaBackgroundPrivate *priv = self->priv;
  guint8 opacity = clutter_actor_get_paint_opacity (actor);
  guint8 color_component;
  int width, height;

  meta_screen_get_size (priv->screen, &width, &height);

  color_component = (int)(0.5 + opacity);

  cogl_material_set_color4ub (priv->material,
                              color_component,
                              color_component,
                              color_component,
                              opacity);

  cogl_set_source (priv->material);

  if (priv->visible_region)
    {
      int n_rectangles = cairo_region_num_rectangles (priv->visible_region);
      int i;

      for (i = 0; i < n_rectangles; i++)
        {
          cairo_rectangle_int_t rect;
          cairo_region_get_rectangle (priv->visible_region, i, &rect);

          cogl_rectangle_with_texture_coords (rect.x, rect.y,
                                              rect.x + rect.width, rect.y + rect.height,
                                              rect.x / priv->texture_width,
                                              rect.y / priv->texture_height,
                                              (rect.x + rect.width) / priv->texture_width,
                                              (rect.y + rect.height) / priv->texture_height);
        }
    }
  else
    {
      cogl_rectangle_with_texture_coords (0.0f, 0.0f,
                                          width, height,
                                          0.0f, 0.0f,
                                          width / priv->texture_width,
                                          height / priv->texture_height);
    }
}
コード例 #8
0
static void
meta_background_dispose (GObject *object)
{
  MetaBackground *self = META_BACKGROUND (object);
  MetaBackgroundPrivate *priv = self->priv;

  meta_background_set_visible_region (self, NULL);

  if (priv->material != COGL_INVALID_HANDLE)
    {
      cogl_handle_unref (priv->material);
      priv->material = COGL_INVALID_HANDLE;
    }

  G_OBJECT_CLASS (meta_background_parent_class)->dispose (object);
}
コード例 #9
0
static void
meta_background_get_preferred_width (ClutterActor *actor,
                                     gfloat        for_height,
                                     gfloat       *min_width_p,
                                     gfloat       *natural_width_p)
{
  MetaBackground *self = META_BACKGROUND (actor);
  MetaBackgroundPrivate *priv = self->priv;
  int width, height;

  meta_screen_get_size (priv->screen, &width, &height);

  if (min_width_p)
    *min_width_p = width;
  if (natural_width_p)
    *natural_width_p = width;
}
コード例 #10
0
ファイル: plugin.c プロジェクト: bighead85/budgie-desktop
static void
background_load_file_cb (GObject      *source_object,
                         GAsyncResult *res,
                         gpointer      user_data)
{
  gboolean r;
  GError *error = NULL;

  r = meta_background_load_file_finish (META_BACKGROUND (source_object), 
                                        res, 
                                        &error);

  if (!r)
  {
    g_warning ("%s", error->message);
    g_error_free (error);
  }
}