Beispiel #1
0
static void
on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
{
  MetaPlugin               *plugin  = META_PLUGIN (data);
  MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
  MetaScreen *screen = meta_plugin_get_screen (plugin);
  GList *l = meta_get_window_actors (screen);

  while (l)
    {
      ClutterActor *a = l->data;
      MetaWindowActor *window_actor = META_WINDOW_ACTOR (a);
      ActorPrivate *apriv = get_actor_private (window_actor);

      if (apriv->orig_parent)
        {
          clutter_actor_reparent (a, apriv->orig_parent);
          apriv->orig_parent = NULL;
        }

      l = l->next;
    }

  clutter_actor_destroy (priv->desktop1);
  clutter_actor_destroy (priv->desktop2);

  priv->tml_switch_workspace1 = NULL;
  priv->tml_switch_workspace2 = NULL;
  priv->desktop1 = NULL;
  priv->desktop2 = NULL;

  meta_plugin_switch_workspace_completed (plugin);
}
static void
mnp_clock_area_drop (MxDroppable *droppable, MxDraggable *draggable, gfloat event_x, gfloat event_y, gint button, ClutterModifierType modifiers)
{
  ClutterActor *self = CLUTTER_ACTOR (droppable);
  ClutterActor *child = CLUTTER_ACTOR (draggable);
  MnpClockTile *tile = (MnpClockTile *)draggable;
  MnpClockArea *area = (MnpClockArea *)droppable;
  GPtrArray *tiles = area->priv->clock_tiles;
  int i, pos;

  g_object_ref (draggable);

  pos = (event_y) / 80;
  if (pos >= tiles->len)
	  pos = tiles->len -1;
 
  clutter_actor_reparent (child, self);

  g_ptr_array_remove (tiles, (gpointer) draggable);
  insert_in_ptr_array (tiles, draggable, pos);

  clutter_actor_set_depth ((ClutterActor *)draggable, ((pos+1) * 0.05) - 0.01);
 
 
  for (i=tiles->len-1; i >= 0; i--) {
	  clutter_actor_set_depth (tiles->pdata[i], (i + 1) * 0.05);
  }
 
  area->priv->zone_reorder_func(mnp_clock_tile_get_location(tile), pos, area->priv->zone_reorder_data);

  g_object_unref (draggable);	
}
Beispiel #3
0
IO_METHOD(IoClutterActor, reparent) {
  clutter_actor_reparent(
    IOCACTOR(self),
    IOCACTOR(IoMessage_locals_clutterActorArgAt_(m, locals, 0))
  );
  return self;
}
Beispiel #4
0
static void
droppable_group_drop (MxDroppable       *droppable,
                      MxDraggable       *draggable,
                      gfloat               event_x,
                      gfloat               event_y,
                      gint                 button,
                      ClutterModifierType  modifiers)
{
  ClutterActor *self = CLUTTER_ACTOR (droppable);
  ClutterActor *child = CLUTTER_ACTOR (draggable);

  g_debug ("%s: dropped %s on '%s' (%s) at %.2f, %.2f",
           G_STRLOC,
           G_OBJECT_TYPE_NAME (draggable),
           clutter_actor_get_name (self),
           G_OBJECT_TYPE_NAME (droppable),
           event_x, event_y);

  g_object_ref (draggable);

  clutter_actor_reparent (child, self);
  clutter_actor_set_position (CLUTTER_ACTOR (draggable),
                              (event_x < 100) ? 50 : 100,
                              (event_y < 100) ? 50 : 100);

  g_object_unref (draggable);
}
Beispiel #5
0
gboolean
foo_button_pressed_cb (ClutterActor *actor,
                       ClutterEvent *event,
                       gpointer      user_data)
{
  ClutterScript *ui = CLUTTER_SCRIPT (user_data);
  ClutterStage *stage = CLUTTER_STAGE (clutter_script_get_object (ui, "stage"));

  ClutterScript *script;
  ClutterActor *rig;
  ClutterAnimator *animator;

  /* load the rig and its animator from a JSON file */
  script = clutter_script_new ();

  /* use a function defined statically in this source file to load the JSON */
  load_script_from_file (script, ANIMATION_FILE);

  clutter_script_get_objects (script,
                              "rig", &rig,
                              "animator", &animator,
                              NULL);

  /* remove the button press handler from the rectangle */
  g_signal_handlers_disconnect_matched (actor,
                                        G_SIGNAL_MATCH_FUNC,
                                        0,
                                        0,
                                        NULL,
                                        foo_button_pressed_cb,
                                        NULL);

  /* add a callback to clean up the script when the rig is destroyed */
  g_object_set_data_full (G_OBJECT (rig), "script", script, g_object_unref);

  /* add the rig to the stage */
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), rig);

  /* place the rig at the same coordinates on the stage as the rectangle */
  clutter_actor_set_position (rig,
                              clutter_actor_get_x (actor),
                              clutter_actor_get_y (actor));

  /* put the rectangle into the top-left corner of the rig */
  clutter_actor_reparent (actor, rig);

  clutter_actor_set_position (actor, 0, 0);

  /* animate the rig */
  clutter_animator_start (animator);

  return TRUE;
}
static void
penge_count_tile_set_compact (PengeCountTile *self,
                              gboolean        compact)
{
  PengeCountTilePrivate *priv = self->priv;

  if (priv->compact == compact)
    return;

  priv->compact = compact;
  if (compact)
  {
    clutter_actor_set_width (CLUTTER_ACTOR (self), -1);
    
    g_object_ref (priv->count_label);
    clutter_container_remove_actor (CLUTTER_CONTAINER (priv->table),
                                    priv->count_label);
    clutter_actor_unparent (priv->count_label);
    clutter_actor_add_child ((self), priv->count_label);

    penge_count_tile_update_tooltip (self);
  }
  else
  {
    clutter_actor_set_width (CLUTTER_ACTOR (self), 280);
    clutter_actor_reparent (priv->count_label, priv->table);
    clutter_container_child_set (CLUTTER_CONTAINER (priv->table),
                                 priv->count_label,
                                 "column", 0,
                                 "row", 0,
                                 "row-span", 2,
                                 "x-expand", FALSE,
                                 NULL);
    clutter_actor_add_child ((self), priv->table);

    mx_widget_set_tooltip_text (MX_WIDGET (self), NULL);
  }
}
Beispiel #7
0
static void
draggable_rectangle_drag_begin (MxDraggable       *draggable,
                                gfloat               event_x,
                                gfloat               event_y,
                                gint                 event_button,
                                ClutterModifierType  modifiers)
{
  ClutterActor *self = CLUTTER_ACTOR (draggable);
  ClutterActor *stage = clutter_actor_get_stage (self);
  gfloat orig_x, orig_y;

  g_object_ref (self);

  clutter_actor_get_transformed_position (self, &orig_x, &orig_y);
  clutter_actor_reparent (self, stage);
  clutter_actor_set_position (self, orig_x, orig_y);

  g_object_unref (self);

  clutter_actor_animate (self, CLUTTER_EASE_OUT_CUBIC, 250,
                         "opacity", 224,
                         NULL);
}
void
mnp_clock_area_add_tile (MnpClockArea *area, MnpClockTile *tile)
{

	clutter_actor_set_reactive ((ClutterActor *)tile, TRUE);
	clutter_actor_set_name ((ClutterActor *)tile, "ClockTile");
	clutter_container_add_actor ((ClutterContainer *)clutter_stage_get_default(), (ClutterActor *)tile);
	mx_draggable_set_axis (MX_DRAGGABLE (tile), MX_DRAG_AXIS_Y);
	mx_draggable_enable ((MxDraggable *)tile);
	clutter_actor_set_size ((ClutterActor *)tile, 230, 75);
	clutter_actor_set_depth ((ClutterActor *)tile, area->priv->position);
	area->priv->position += 0.05;
	clutter_actor_reparent ((ClutterActor *)tile, (ClutterActor *)area);
  	clutter_container_child_set (CLUTTER_CONTAINER (area),
                               (ClutterActor *)tile,
                               "expand", FALSE,
			       "y-fill", FALSE,
			       "x-fill", TRUE,
                               NULL);	
	g_ptr_array_add (area->priv->clock_tiles, tile);
	mnp_clock_tile_set_remove_cb (tile, (TileRemoveFunc)mnp_clock_tile_removed, (gpointer)area);

	g_signal_connect (tile, "drag-y-pos", G_CALLBACK(tile_drag_run), area);
}
Beispiel #9
0
static void
switch_workspace (MetaPlugin *plugin,
                  gint from, gint to,
                  MetaMotionDirection direction)
{
  MetaScreen *screen;
  MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
  GList        *l;
  ClutterActor *workspace0  = clutter_group_new ();
  ClutterActor *workspace1  = clutter_group_new ();
  ClutterActor *stage;
  int           screen_width, screen_height;
  ClutterAnimation *animation;

  screen = meta_plugin_get_screen (plugin);
  stage = meta_get_stage_for_screen (screen);

  meta_screen_get_size (screen,
                        &screen_width,
                        &screen_height);

  clutter_actor_set_anchor_point (workspace1,
                                  screen_width,
                                  screen_height);
  clutter_actor_set_position (workspace1,
                              screen_width,
                              screen_height);

  clutter_actor_set_scale (workspace1, 0.0, 0.0);

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), workspace1);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), workspace0);

  if (from == to)
    {
      meta_plugin_switch_workspace_completed (plugin);
      return;
    }

  l = g_list_last (meta_get_window_actors (screen));

  while (l)
    {
      MetaWindowActor *window_actor = l->data;
      MetaWindow *window = meta_window_actor_get_meta_window (window_actor);
      MetaWorkspace   *workspace;
      ActorPrivate    *apriv	    = get_actor_private (window_actor);
      ClutterActor    *actor	    = CLUTTER_ACTOR (window_actor);
      gint             win_workspace;

      workspace = meta_window_get_workspace (window);
      win_workspace = meta_workspace_index (workspace);

      if (win_workspace == to || win_workspace == from)
        {
          apriv->orig_parent = clutter_actor_get_parent (actor);

          clutter_actor_reparent (actor,
				  win_workspace == to ? workspace1 : workspace0);
          clutter_actor_show_all (actor);
          clutter_actor_raise_top (actor);
        }
      else if (win_workspace < 0)
        {
          /* Sticky window */
          apriv->orig_parent = NULL;
        }
      else
        {
          /* Window on some other desktop */
          clutter_actor_hide (actor);
          apriv->orig_parent = NULL;
        }

      l = l->prev;
    }

  priv->desktop1 = workspace0;
  priv->desktop2 = workspace1;

  animation = clutter_actor_animate (workspace0, CLUTTER_EASE_IN_SINE,
                                     SWITCH_TIMEOUT,
                                     "scale-x", 1.0,
                                     "scale-y", 1.0,
                                     NULL);
  priv->tml_switch_workspace1 = clutter_animation_get_timeline (animation);
  g_signal_connect (priv->tml_switch_workspace1,
                    "completed",
                    G_CALLBACK (on_switch_workspace_effect_complete),
                    plugin);

  animation = clutter_actor_animate (workspace1, CLUTTER_EASE_IN_SINE,
                                     SWITCH_TIMEOUT,
                                     "scale-x", 0.0,
                                     "scale-y", 0.0,
                                     NULL);
  priv->tml_switch_workspace2 = clutter_animation_get_timeline (animation);
}