static void add_drag_object (ClutterActor *target) { ClutterActor *parent; if (drag == NULL) { ClutterAction *action; drag = clutter_actor_new (); clutter_actor_set_background_color (drag, CLUTTER_COLOR_LightSkyBlue); clutter_actor_set_size (drag, HANDLE_SIZE, HANDLE_SIZE); clutter_actor_set_position (drag, (TARGET_SIZE - HANDLE_SIZE) / 2.0, (TARGET_SIZE - HANDLE_SIZE) / 2.0); clutter_actor_set_reactive (drag, TRUE); action = clutter_drag_action_new (); g_signal_connect (action, "drag-begin", G_CALLBACK (on_drag_begin), NULL); g_signal_connect (action, "drag-end", G_CALLBACK (on_drag_end), NULL); clutter_actor_add_action (drag, action); } parent = clutter_actor_get_parent (drag); if (parent == target) { clutter_actor_save_easing_state (target); clutter_actor_set_easing_mode (target, CLUTTER_LINEAR); clutter_actor_set_opacity (target, 255); clutter_actor_restore_easing_state (target); return; } g_object_ref (drag); if (parent != NULL && parent != stage) { clutter_actor_remove_child (parent, drag); clutter_actor_save_easing_state (parent); clutter_actor_set_easing_mode (parent, CLUTTER_LINEAR); clutter_actor_set_opacity (parent, 64); clutter_actor_restore_easing_state (parent); } clutter_actor_add_child (target, drag); clutter_actor_save_easing_state (target); clutter_actor_set_easing_mode (target, CLUTTER_LINEAR); clutter_actor_set_opacity (target, 255); clutter_actor_restore_easing_state (target); g_object_unref (drag); }
static void on_drag_end (ClutterDragAction *action, ClutterActor *actor, gfloat event_x, gfloat event_y, ClutterModifierType modifiers) { ClutterActor *handle = clutter_drag_action_get_drag_handle (action); g_print ("Drag ended at: %.0f, %.0f\n", event_x, event_y); clutter_actor_save_easing_state (actor); clutter_actor_set_easing_mode (actor, CLUTTER_LINEAR); clutter_actor_set_opacity (actor, 255); clutter_actor_restore_easing_state (actor); clutter_actor_save_easing_state (handle); if (!drop_successful) { ClutterActor *parent = clutter_actor_get_parent (actor); gfloat x_pos, y_pos; clutter_actor_save_easing_state (parent); clutter_actor_set_easing_mode (parent, CLUTTER_LINEAR); clutter_actor_set_opacity (parent, 255); clutter_actor_restore_easing_state (parent); clutter_actor_get_transformed_position (actor, &x_pos, &y_pos); clutter_actor_set_easing_mode (handle, CLUTTER_EASE_OUT_BOUNCE); clutter_actor_set_position (handle, x_pos, y_pos); clutter_actor_set_opacity (handle, 0); clutter_actor_restore_easing_state (handle); } else { clutter_actor_set_easing_mode (handle, CLUTTER_LINEAR); clutter_actor_set_opacity (handle, 0); } clutter_actor_restore_easing_state (handle); g_signal_connect (handle, "transitions-completed", G_CALLBACK (clutter_actor_destroy), NULL); }
void meta_compositor_flash_window (MetaCompositor *compositor, MetaWindow *window) { ClutterActor *window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window)); ClutterActor *flash; ClutterTransition *transition; flash = clutter_actor_new (); clutter_actor_set_background_color (flash, CLUTTER_COLOR_Black); clutter_actor_set_size (flash, window->rect.width, window->rect.height); clutter_actor_set_position (flash, window->custom_frame_extents.left, window->custom_frame_extents.top); clutter_actor_set_opacity (flash, 0); clutter_actor_add_child (window_actor, flash); clutter_actor_save_easing_state (flash); clutter_actor_set_easing_mode (flash, CLUTTER_EASE_IN_QUAD); clutter_actor_set_easing_duration (flash, FLASH_TIME_MS); clutter_actor_set_opacity (flash, 192); transition = clutter_actor_get_transition (flash, "opacity"); clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE); clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2); g_signal_connect (transition, "stopped", G_CALLBACK (window_flash_out_completed), flash); clutter_actor_restore_easing_state (flash); }
static void mx_notebook_update_children (MxNotebook *book) { MxNotebookPrivate *priv = book->priv; GList *l; for (l = priv->children; l; l = l->next) { ClutterActor *child = CLUTTER_ACTOR (l->data); if (child == priv->current_page) { clutter_actor_show (child); clutter_actor_save_easing_state (child); clutter_actor_set_easing_mode (child, CLUTTER_LINEAR); clutter_actor_set_easing_duration (child, 250); clutter_actor_set_opacity (child, 0xff); clutter_actor_restore_easing_state (child); g_signal_connect (child, "transition-stopped::opacity", G_CALLBACK (mx_notebook_show_complete_cb), book); } } }
void meta_compositor_flash_screen (MetaCompositor *compositor, MetaScreen *screen) { ClutterActor *stage; ClutterActor *flash; ClutterTransition *transition; gfloat width, height; stage = meta_get_stage_for_screen (screen); clutter_actor_get_size (stage, &width, &height); flash = clutter_actor_new (); clutter_actor_set_background_color (flash, CLUTTER_COLOR_Black); clutter_actor_set_size (flash, width, height); clutter_actor_set_opacity (flash, 0); clutter_actor_add_child (stage, flash); clutter_actor_save_easing_state (flash); clutter_actor_set_easing_mode (flash, CLUTTER_EASE_IN_QUAD); clutter_actor_set_easing_duration (flash, FLASH_TIME_MS); clutter_actor_set_opacity (flash, 192); transition = clutter_actor_get_transition (flash, "opacity"); clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE); clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2); g_signal_connect (transition, "stopped", G_CALLBACK (flash_out_completed), flash); clutter_actor_restore_easing_state (flash); }
static void on_drag_begin (ClutterDragAction *action, ClutterActor *actor, gfloat event_x, gfloat event_y, ClutterModifierType modifiers) { ClutterActor *handle; gfloat x_pos, y_pos; clutter_actor_get_position (actor, &x_pos, &y_pos); handle = clutter_actor_new (); clutter_actor_set_background_color (handle, CLUTTER_COLOR_DarkSkyBlue); clutter_actor_set_size (handle, 128, 128); clutter_actor_set_position (handle, event_x - x_pos, event_y - y_pos); clutter_actor_add_child (stage, handle); clutter_drag_action_set_drag_handle (action, handle); clutter_actor_save_easing_state (actor); clutter_actor_set_easing_mode (actor, CLUTTER_LINEAR); clutter_actor_set_opacity (actor, 128); clutter_actor_restore_easing_state (actor); drop_successful = FALSE; }
static void fade_out (ClutterActor *actor) { clutter_actor_save_easing_state (actor); clutter_actor_set_easing_duration (actor, FADE_OUT_TIME); clutter_actor_set_opacity (actor, 0); clutter_actor_restore_easing_state (actor); }
static void overview_animated_destroy(MosesOverview* self, MosesOverviewQuitReason reason, gboolean animate) { MosesOverviewPrivate* priv = self->priv; gboolean just_destroy = !animate; if (reason == MOSES_OV_REASON_ACTIVATE_WINDOW && !priv->selected_actor) { just_destroy = TRUE; } else if (reason == MOSES_OV_REASON_ACTIVATE_WORKSPACE && !priv->selected_workspace) { just_destroy = TRUE; } else if (reason == MOSES_OV_REASON_NORMAL) { just_destroy = TRUE; } if (just_destroy) { clutter_actor_destroy(CLUTTER_ACTOR(self)); return; } gfloat x, y, w, h; ClutterActor* target = NULL; if (reason == MOSES_OV_REASON_ACTIVATE_WINDOW) { target = self->priv->selected_actor; ClutterActor* orig = clutter_clone_get_source(CLUTTER_CLONE(target)); clutter_actor_get_position(orig, &x, &y); clutter_actor_get_size(orig, &w, &h); g_signal_handlers_disconnect_by_func(target, on_effect_complete, self); } else if (reason == MOSES_OV_REASON_ACTIVATE_WORKSPACE) { g_assert(priv->selected_actor == NULL); MetaScreen* screen = meta_plugin_get_screen(priv->plugin); target = overview_head_get_actor_for_workspace(priv->ov_head, priv->selected_workspace); MetaRectangle geom; int focused_monitor = meta_screen_get_current_monitor(screen); meta_screen_get_monitor_geometry(screen, focused_monitor, &geom); x = geom.x, y = geom.y, w = geom.width, h = geom.height; } if (target) { clutter_actor_remove_all_transitions(target); clutter_actor_set_child_above_sibling(clutter_actor_get_parent(target), target, NULL); clutter_actor_save_easing_state(target); clutter_actor_set_easing_mode(target, CLUTTER_LINEAR); clutter_actor_set_easing_duration(target, 150); clutter_actor_set_position(target, x, y); clutter_actor_set_scale(target, w / clutter_actor_get_width(target), h / clutter_actor_get_height(target)); clutter_actor_restore_easing_state(target); g_object_connect(target, "signal::transitions-completed", G_CALLBACK(on_restore_position_effect_complete), self, NULL); } }
void map(MetaPlugin *plugin, MetaWindowActor *window_actor) { ClutterActor *actor = CLUTTER_ACTOR(window_actor); clutter_actor_remove_all_transitions(actor); switch (MWT(window_actor)) { case META_WINDOW_POPUP_MENU: case META_WINDOW_DROPDOWN_MENU: case META_WINDOW_NOTIFICATION: case META_WINDOW_MENU: /* For menus we'll give em a nice fade in */ g_object_set(actor, "opacity", 0, NULL); clutter_actor_show(actor); clutter_actor_save_easing_state(actor); clutter_actor_set_easing_mode(actor, CLUTTER_EASE_IN_SINE); clutter_actor_set_easing_duration(actor, FADE_TIMEOUT); g_signal_connect(actor, "transitions-completed", G_CALLBACK(map_done), plugin); g_object_set(actor, "opacity", 255, NULL); clutter_actor_restore_easing_state(actor); break; case META_WINDOW_NORMAL: case META_WINDOW_DIALOG: case META_WINDOW_MODAL_DIALOG: g_object_set(actor, "opacity", 0, "scale-x", MAP_SCALE, "scale-y", MAP_SCALE, "pivot-point", &PV_CENTER, NULL); clutter_actor_show(actor); /* Initialise animation */ clutter_actor_save_easing_state(actor); clutter_actor_set_easing_mode(actor, CLUTTER_EASE_IN_SINE); clutter_actor_set_easing_duration(actor, MAP_TIMEOUT); g_signal_connect(actor, "transitions-completed", G_CALLBACK(map_done), plugin); /* Now animate. */ g_object_set(actor, "scale-x", 1.0, "scale-y", 1.0, "opacity", 255, NULL); clutter_actor_restore_easing_state(actor); break; default: meta_plugin_map_completed(plugin, window_actor); break; } }
static void budgie_wm_start(MetaPlugin *plugin) { BudgieWM *self = BUDGIE_WM(plugin); MetaScreen *screen = meta_plugin_get_screen(plugin); ClutterActor* actors[2]; /* Init background */ self->priv->background_group = meta_background_group_new(); clutter_actor_set_reactive(self->priv->background_group, TRUE); clutter_actor_insert_child_below(meta_get_window_group_for_screen(screen), self->priv->background_group, NULL); g_signal_connect(screen, "monitors-changed", G_CALLBACK(on_monitors_changed), plugin); on_monitors_changed(screen, plugin); /* Now we're in action. */ clutter_actor_show(meta_get_window_group_for_screen(screen)); clutter_actor_show(self->priv->background_group); clutter_actor_set_opacity(meta_get_window_group_for_screen(screen), 0); clutter_actor_set_opacity(self->priv->background_group, 0); actors[0] = meta_get_window_group_for_screen(screen); actors[1] = self->priv->background_group; clutter_actor_set_background_color(meta_get_stage_for_screen(screen), clutter_color_get_static(CLUTTER_COLOR_BLACK)); clutter_actor_show(meta_get_stage_for_screen(screen)); for (int i = 0; i < 2; i++) { clutter_actor_save_easing_state(actors[i]); clutter_actor_set_easing_mode(actors[i], CLUTTER_EASE_OUT_QUAD); clutter_actor_set_easing_duration(actors[i], SHOW_TIMEOUT); g_object_set(actors[i], "opacity", 255, NULL); clutter_actor_restore_easing_state(actors[i]); } /* Set up our own keybinding overrides */ meta_keybindings_set_custom_handler(BUDGIE_KEYBINDING_MAIN_MENU, budgie_launch_menu, NULL, NULL); meta_keybindings_set_custom_handler(BUDGIE_KEYBINDING_RUN_DIALOG, budgie_launch_rundialog, NULL, NULL); meta_keybindings_set_custom_handler("switch-windows", (MetaKeyHandlerFunc)switch_windows, self, NULL); meta_keybindings_set_custom_handler("switch-applications", (MetaKeyHandlerFunc)switch_windows, self, NULL); /* Handle keys.. */ budgie_keys_init(meta_screen_get_display(screen)); budgie_menus_init(self); g_signal_connect(meta_screen_get_display(screen), "overlay-key", G_CALLBACK(overlay_cb), NULL); }
static void plate5anim (ClutterTimeline *timeline, const gchar *marker_name, guint frame_num, ClutterActor *lowerInner) { clutter_actor_save_easing_state (lowerInner); clutter_actor_set_easing_duration (lowerInner, 875); clutter_actor_set_easing_mode (lowerInner, CLUTTER_EASE_OUT_EXPO); clutter_actor_set_position(lowerInner, 0, 0); clutter_actor_restore_easing_state (lowerInner); }
static void plate4anim (ClutterTimeline *timeline, const gchar *marker_name, guint frame_num, ClutterActor *fixed) { clutter_actor_save_easing_state (fixed); clutter_actor_set_easing_duration (fixed, 1250); clutter_actor_set_easing_mode (fixed, CLUTTER_EASE_OUT_EXPO); clutter_actor_set_position(fixed, 0, 0); clutter_actor_restore_easing_state (fixed); }
static void plate1anim (ClutterTimeline *timeline, const gchar *marker_name, guint frame_num, ClutterActor *bg) { clutter_actor_set_easing_duration (bg, 750); clutter_actor_save_easing_state (bg); clutter_actor_set_easing_mode (bg, CLUTTER_EASE_OUT_CIRC); clutter_actor_set_x_align (bg, CLUTTER_ACTOR_ALIGN_FILL); clutter_actor_restore_easing_state (bg); }
static void plate3anim (ClutterTimeline *timeline, const gchar *marker_name, guint frame_num, ClutterActor *labelbg) { clutter_actor_save_easing_state (labelbg); clutter_actor_set_easing_duration (labelbg, 583); clutter_actor_set_easing_mode (labelbg, CLUTTER_EASE_OUT_CUBIC); clutter_actor_set_width(labelbg, 400); clutter_actor_restore_easing_state (labelbg); }
static gboolean on_box_leave (ClutterActor *box, ClutterEvent *event, ClutterActor *emblem) { clutter_actor_save_easing_state (emblem); clutter_actor_set_easing_mode (emblem, CLUTTER_LINEAR); clutter_actor_set_opacity (emblem, 0); clutter_actor_restore_easing_state (emblem); return CLUTTER_EVENT_STOP; }
static void mx_tooltip_set_opacity (MxTooltip *tooltip, guchar opacity) { ClutterActor *self = CLUTTER_ACTOR (tooltip); clutter_actor_save_easing_state (self); clutter_actor_set_easing_mode (self, CLUTTER_EASE_OUT_QUAD); clutter_actor_set_easing_duration (self, 150); clutter_actor_set_opacity (self, opacity); clutter_actor_restore_easing_state (self); }
static gboolean on_box_enter (ClutterActor *box, ClutterEvent *event, ClutterActor *emblem) { /* we ease the opacity linearly */ clutter_actor_save_easing_state (emblem); clutter_actor_set_easing_mode (emblem, CLUTTER_LINEAR); clutter_actor_set_opacity (emblem, 255); clutter_actor_restore_easing_state (emblem); return CLUTTER_EVENT_STOP; }
void destroy(MetaPlugin *plugin, MetaWindowActor *window_actor) { ClutterActor *actor = CLUTTER_ACTOR(window_actor); clutter_actor_remove_all_transitions(actor); switch (MWT(window_actor)) { case META_WINDOW_NOTIFICATION: case META_WINDOW_NORMAL: case META_WINDOW_DIALOG: case META_WINDOW_MODAL_DIALOG: /* Initialise animation */ g_object_set(actor, "pivot-point", &PV_CENTER, NULL); clutter_actor_save_easing_state(actor); clutter_actor_set_easing_mode(actor, CLUTTER_EASE_OUT_QUAD); clutter_actor_set_easing_duration(actor, DESTROY_TIMEOUT); g_signal_connect(actor, "transitions-completed", G_CALLBACK(destroy_done), plugin); /* Now animate. */ g_object_set(actor, "scale-x", DESTROY_SCALE, "scale-y", DESTROY_SCALE, "opacity", 0, NULL); clutter_actor_restore_easing_state(actor); break; case META_WINDOW_MENU: /* Initialise animation */ clutter_actor_save_easing_state(actor); clutter_actor_set_easing_mode(actor, CLUTTER_EASE_OUT_QUAD); clutter_actor_set_easing_duration(actor, DESTROY_TIMEOUT); g_signal_connect(actor, "transitions-completed", G_CALLBACK(destroy_done), plugin); /* Now animate. */ g_object_set(actor, "opacity", 0, NULL); clutter_actor_restore_easing_state(actor); break; default: meta_plugin_destroy_completed(plugin, window_actor); break; } }
static void place_window(MosesOverview* self, ClutterActor* actor, MetaRectangle rect) { g_debug("%s: %d,%d,%d,%d", __func__, rect.x, rect.y, rect.width, rect.height); float fscale = rect.width / clutter_actor_get_width(actor); clutter_actor_save_easing_state(actor); clutter_actor_set_easing_mode(actor, CLUTTER_EASE_OUT_CUBIC); clutter_actor_set_easing_duration(actor, PLACEMENT_ANIMATION_DURATION); clutter_actor_set_scale(actor, fscale, fscale); clutter_actor_set_position(actor, rect.x, rect.y); /*clutter_actor_set_size(actor, rect.width, rect.height);*/ clutter_actor_restore_easing_state(actor); }
static void mx_menu_close (ClutterActor *menu) { ClutterActor *actor = (ClutterActor *) menu; clutter_actor_save_easing_state (actor); clutter_actor_set_easing_mode (actor, CLUTTER_LINEAR); clutter_actor_set_easing_duration (actor, 250); clutter_actor_set_opacity (actor, 0); clutter_actor_restore_easing_state (actor); g_signal_connect (actor, "transition-stopped::opacity", G_CALLBACK (mx_menu_close_complete), NULL); clutter_actor_set_reactive ((ClutterActor*) menu, FALSE); }
static void on_target_over (ClutterDropAction *action, ClutterActor *actor, gpointer _data) { gboolean is_over = GPOINTER_TO_UINT (_data); guint8 final_opacity = is_over ? 128 : 64; ClutterActor *target; target = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action)); clutter_actor_save_easing_state (target); clutter_actor_set_easing_mode (target, CLUTTER_LINEAR); clutter_actor_set_opacity (target, final_opacity); clutter_actor_restore_easing_state (target); }
static void on_window_removed(MetaWorkspace *ws, MetaWindow *win, MetaSwitcher* self) { g_debug("%s", __func__); MetaSwitcherPrivate* priv = self->priv; ClutterActor* win_actor = NULL; gboolean need_reselect = FALSE; int id = 0; for (id = 0; id < priv->apps->len; id++) { if (g_ptr_array_index(priv->apps, id) == win) { win_actor = g_hash_table_lookup(priv->icons, win); need_reselect = (id == priv->selected_id); } } if (win_actor) { if (need_reselect) _set_highlight(self, priv->selected_id, FALSE); g_hash_table_remove(priv->icons, win); g_ptr_array_remove(priv->apps, win); if (need_reselect) { if (id == 0) { clutter_actor_set_margin_left( g_hash_table_lookup(priv->icons, g_ptr_array_index(priv->apps, 0)), 10); } else if (id >= priv->apps->len) { clutter_actor_set_margin_right( g_hash_table_lookup(priv->icons, g_ptr_array_index(priv->apps, priv->apps->len-1)), 10); } priv->selected_id = (priv->selected_id + 1) % priv->apps->len; _set_highlight(self, priv->selected_id, TRUE); } clutter_actor_save_easing_state(priv->top); clutter_actor_set_easing_duration(priv->top, 200); clutter_actor_set_easing_mode(priv->top, CLUTTER_LINEAR); clutter_actor_remove_child(priv->top, win_actor); clutter_actor_restore_easing_state(priv->top); reposition_switcher(self); } }
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)); } }
static void reposition_switcher(MetaSwitcher* self) { MetaSwitcherPrivate* priv = self->priv; MetaScreen* screen = meta_plugin_get_screen(priv->plugin); gint screen_width = 0, screen_height = 0; meta_screen_get_size(screen, &screen_width, &screen_height); clutter_actor_save_easing_state(priv->top); clutter_actor_set_easing_duration(priv->top, 400); clutter_actor_set_easing_mode(priv->top, CLUTTER_LINEAR); gfloat w = clutter_actor_get_width(priv->top), h = clutter_actor_get_height(priv->top), tx = (screen_width - w)/2, ty = (screen_height - h)/2; clutter_actor_set_position(priv->top, tx, ty); clutter_actor_restore_easing_state(priv->top); }
static void timeline_complete (ClutterTimeline *timeline, ClutterActor *expander) { guchar opacity; MxExpanderPrivate *priv = MX_EXPANDER (expander)->priv; g_signal_emit (expander, expander_signals[EXPAND_COMPLETE], 0); /* if the expander is now closed, update the style */ if (!priv->expanded) { clutter_actor_set_name (priv->arrow, "mx-expander-arrow-closed"); mx_stylable_set_style_class (MX_STYLABLE (expander), "closed-expander"); clutter_actor_queue_relayout (expander); } if (!priv->child) return; /* continue only if we are "opening" */ if (!priv->expanded) return; /* we can't do an animation if there is already one in progress, * because we cannot get the actors original opacity */ if (clutter_actor_get_transition (priv->child, "opacity")) { clutter_actor_show (priv->child); return; } opacity = clutter_actor_get_opacity (priv->child); clutter_actor_set_opacity (priv->child, 0); clutter_actor_show (priv->child); clutter_actor_save_easing_state (priv->child); clutter_actor_set_easing_mode (priv->child, CLUTTER_EASE_IN_SINE); clutter_actor_set_easing_duration (priv->child, 100); clutter_actor_set_opacity (priv->child, opacity); clutter_actor_restore_easing_state (priv->child); }
static void on_emblem_clicked (ClutterClickAction *action, ClutterActor *emblem, ClutterActor *box) { /* we add a little bounce to the resizing of the box */ clutter_actor_save_easing_state (box); clutter_actor_set_easing_mode (box, CLUTTER_EASE_OUT_BOUNCE); clutter_actor_set_easing_duration (box, 500); if (!is_expanded) clutter_actor_set_size (box, 400, 400); else clutter_actor_set_size (box, 200, 200); clutter_actor_restore_easing_state (box); is_expanded = !is_expanded; }
static gboolean on_key_press (ClutterActor *stage, ClutterEvent *event, gpointer unused) { ClutterActor *scroll; guint key_symbol; scroll = clutter_actor_get_first_child (stage); key_symbol = clutter_event_get_key_symbol (event); if (key_symbol == CLUTTER_KEY_space) { clutter_actor_save_easing_state (scroll); clutter_actor_set_easing_duration (scroll, 1000); clutter_actor_set_child_transform (scroll, NULL); clutter_actor_restore_easing_state (scroll); } return CLUTTER_EVENT_STOP; }
//FIXME: ClutterClone seems to have problem rendering children, so badges are stay in grandpar static void create_window_badge(MosesOverview* self, ClutterActor* parent, int order) { ClutterActor* badge = clutter_actor_new(); clutter_actor_insert_child_above(clutter_actor_get_parent(parent), badge, NULL); gfloat tw, th; clutter_actor_get_transformed_size(parent, &tw, &th); gfloat w = 60.0, h = 60.0, x = (tw - w) / 2.0 + clutter_actor_get_x(parent), y = (th - h) / 2.0 + clutter_actor_get_y(parent); clutter_actor_set_position(badge, x, y); clutter_actor_set_size(badge, w, h); g_object_set_qdata(G_OBJECT(badge), moses_overview_window_clone_order(), GINT_TO_POINTER(order)); g_object_set_qdata(G_OBJECT(parent), moses_overview_window_clone_order(), GINT_TO_POINTER(order)); ClutterContent* canvas = clutter_canvas_new(); clutter_canvas_set_size(CLUTTER_CANVAS(canvas), w, h); clutter_actor_set_content(badge, canvas); g_object_unref(canvas); g_signal_connect(canvas, "draw", G_CALLBACK(on_badge_draw), badge); clutter_content_invalidate(canvas); clutter_actor_set_scale(badge, 0.0, 0.0); //do animated show clutter_actor_save_easing_state(badge); clutter_actor_set_easing_mode(badge, CLUTTER_EASE_OUT_BACK); clutter_actor_set_easing_duration(badge, 350); clutter_actor_set_pivot_point(badge, 0.5, 0.5); clutter_actor_set_scale(badge, 1.0, 1.0); clutter_actor_restore_easing_state(badge); g_ptr_array_add(self->priv->badges, badge); }
static void mnb_zones_preview_completed_cb (ClutterAnimation *animation, MnbZonesPreview *preview) { MnbZonesPreviewPrivate *priv = preview->priv; switch (priv->anim_phase) { case MNB_ZP_STATIC: /* Start zooming out */ priv->anim_phase = MNB_ZP_ZOOM_OUT; mnb_zones_preview_enable_fanciness (preview, TRUE); clutter_actor_save_easing_state (CLUTTER_ACTOR(preview)); clutter_actor_set_easing_duration (CLUTTER_ACTOR(preview), 220); clutter_actor_set_easing_mode(CLUTTER_ACTOR(preview), CLUTTER_EASE_IN_SINE); clutter_actor_set_scale(CLUTTER_ACTOR(preview), 0.3f, 0.3f); clutter_actor_restore_easing_state (CLUTTER_ACTOR(preview)); break; case MNB_ZP_ZOOM_OUT: /* Start panning */ { guint duration = 175 * abs (priv->dest_workspace - priv->workspace); if (duration) { priv->anim_phase = MNB_ZP_PAN; clutter_actor_save_easing_state (CLUTTER_ACTOR(preview)); clutter_actor_set_easing_duration (CLUTTER_ACTOR(preview), duration); clutter_actor_set_easing_mode(CLUTTER_ACTOR(preview), CLUTTER_LINEAR); clutter_actor_set_scale(CLUTTER_ACTOR(preview), (gdouble)priv->dest_workspace, (gdouble)priv->dest_workspace); clutter_actor_restore_easing_state (CLUTTER_ACTOR(preview)); break; } /* If duration == 0, fall through here to the next phase*/ } case MNB_ZP_PAN: /* Start zooming in */ mnb_zones_preview_enable_fanciness (preview, FALSE); priv->anim_phase = MNB_ZP_ZOOM_IN; clutter_actor_save_easing_state (CLUTTER_ACTOR(preview)); clutter_actor_set_easing_duration (CLUTTER_ACTOR(preview), 250); clutter_actor_set_easing_mode(CLUTTER_ACTOR(preview), CLUTTER_EASE_OUT_CUBIC); clutter_actor_set_scale(CLUTTER_ACTOR(preview), 1.0f, 1.0f); clutter_actor_restore_easing_state (CLUTTER_ACTOR(preview)); break; case MNB_ZP_ZOOM_IN: /* Complete the animation */ priv->anim_phase = MNB_ZP_STATIC; g_signal_emit (preview, signals[SWITCH_COMPLETED], 0); return; default: g_warning (G_STRLOC ": This shouldn't happen"); return; } animation = clutter_actor_get_animation (CLUTTER_ACTOR (preview)); g_signal_connect_after (animation, "completed", G_CALLBACK (mnb_zones_preview_completed_cb), preview); }
void ntf_tray_add_notification (NtfTray *tray, NtfNotification *ntf) { NtfTrayPrivate *priv; ClutterActor *ntfa; ClutterAnimation *anim; MetaPlugin *plugin; g_return_if_fail (NTF_IS_TRAY (tray) && NTF_IS_NOTIFICATION (ntf)); priv = tray->priv; ntfa = CLUTTER_ACTOR (ntf); plugin = meego_netbook_get_plugin_singleton (); if (meego_netbook_compositor_disabled (plugin)) { mnb_notification_gtk_show (); } g_signal_connect (ntf, "closed", G_CALLBACK (ntf_tray_notification_closed_cb), tray); clutter_actor_add_child (CLUTTER_ACTOR (priv->notifiers), ntfa); clutter_actor_set_width (ntfa, CLUSTER_WIDTH); priv->n_notifiers++; if (priv->n_notifiers == 1) { /* May have been previously hidden */ clutter_actor_show (CLUTTER_ACTOR (tray)); /* show just the single notification */ priv->active_notifier = ntfa; clutter_actor_set_opacity (ntfa, 0); clutter_actor_save_easing_state (ntfa); clutter_actor_set_easing_duration (ntfa, FADE_DURATION); clutter_actor_set_easing_mode(ntfa, CLUTTER_EASE_IN_SINE); clutter_actor_set_y(ntfa, 0xff); clutter_actor_restore_easing_state (ntfa); } else if (priv->n_notifiers == 2) { /* slide the control into view */ mx_label_set_text (MX_LABEL(priv->control_text), _("1 pending message")); clutter_actor_show (priv->control); clutter_actor_set_opacity (priv->control, 0); clutter_actor_set_y (priv->control, clutter_actor_get_height (priv->active_notifier) - clutter_actor_get_height (priv->control) - 30); anim = clutter_actor_animate (priv->control, CLUTTER_EASE_IN_SINE, FADE_DURATION, "opacity", 0xff, "y", clutter_actor_get_height (priv->active_notifier)- 30, NULL); } else { /* simply update the control */ gchar *msg; msg = g_strdup_printf (_("%i pending messages"), priv->n_notifiers-1); mx_label_set_text (MX_LABEL (priv->control_text), msg); g_free (msg); } }