[gnome-boxes] Switch to per-actor easing states



commit a6a6909148c4122c2ad47fccb5330ffafc10de02
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 21 16:36:04 2012 +0200

    Switch to per-actor easing states
    
    Instead of using layout animations on the overlay_bin we
    use the new clutter support for per-actor default easing
    states. This means we can now disable animations of the
    thumbnail in properties view after the initial animation.
    
    Also, its possible that the layout manager animation
    feature will be removed, so better not rely on it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678545

 src/app.vala             |    3 ---
 src/collection-view.vala |    5 +++++
 src/machine.vala         |   16 ++++++++++++++++
 3 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 732cfcd..ede6b4b 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -439,9 +439,6 @@ private class Boxes.App: Boxes.UI {
         overlay_bin = new Clutter.BinLayout (Clutter.BinAlignment.FIXED,
                                              Clutter.BinAlignment.FIXED);
         overlay_bin_actor.set_layout_manager (overlay_bin);
-        overlay_bin.set ("use-animations", true,
-                         "easing-mode", Clutter.AnimationMode.LINEAR,
-                         "easing-duration", duration);
         below_bin.add (overlay_bin_actor,
                        Clutter.BinAlignment.FILL,
                        Clutter.BinAlignment.FILL);
diff --git a/src/collection-view.vala b/src/collection-view.vala
index ddcf176..ae190a9 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -45,6 +45,7 @@ private class Boxes.CollectionView: Boxes.UI {
             icon_view.unselect_all ();
             if (current_item != null) {
                 var actor = current_item.actor;
+                actor.set_easing_duration (0);
                 actor.show ();
 
                 App.app.overlay_bin.set_alignment (actor,
@@ -55,6 +56,7 @@ private class Boxes.CollectionView: Boxes.UI {
                 actor.y = 20;
                 actor.min_width = actor.natural_width = Machine.SCREENSHOT_WIDTH;
 
+                actor.set_easing_duration (App.app.duration);
                 ulong completed_id = 0;
                 completed_id = actor.transitions_completed.connect (() => {
                     actor.disconnect (completed_id);
@@ -71,15 +73,18 @@ private class Boxes.CollectionView: Boxes.UI {
                 App.app.overlay_bin.add (actor,
                                          Clutter.BinAlignment.FIXED,
                                          Clutter.BinAlignment.FIXED);
+                actor.set_easing_mode (Clutter.AnimationMode.LINEAR);
 
                 // TODO: How do I get the icon coords from the iconview?
                 Clutter.ActorBox box = { 20, 20, 20 + Machine.SCREENSHOT_WIDTH, 20 + Machine.SCREENSHOT_HEIGHT * 2};
                 actor.allocate (box, 0);
+
             }
             actor.min_width = actor.natural_width = Machine.SCREENSHOT_WIDTH * 2;
             App.app.overlay_bin.set_alignment (actor,
                                                Clutter.BinAlignment.CENTER,
                                                Clutter.BinAlignment.CENTER);
+            actor.set_easing_duration (App.app.duration);
             break;
 
         case UIState.WIZARD:
diff --git a/src/machine.vala b/src/machine.vala
index 6ba9921..1c3faa9 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -437,6 +437,7 @@ private class Boxes.MachineActor: Boxes.UI {
                     App.app.properties.screenshot_placeholder.disconnect (track_screenshot_id);
                     track_screenshot_id = 0;
 
+                    display.set_easing_duration (App.app.duration);
                     App.app.overlay_bin.set_alignment (display,
                                                        Clutter.BinAlignment.FILL,
                                                        Clutter.BinAlignment.FILL);
@@ -466,6 +467,7 @@ private class Boxes.MachineActor: Boxes.UI {
             machine.display.set_enable_inputs (widget, false);
             display = new GtkClutter.Actor.with_contents (widget);
             display.name = "properties-thumbnail";
+            display.set_easing_mode (Clutter.AnimationMode.LINEAR);
             App.app.overlay_bin.add (display,
                                      Clutter.BinAlignment.FILL,
                                      Clutter.BinAlignment.FILL);
@@ -479,16 +481,30 @@ private class Boxes.MachineActor: Boxes.UI {
             if (App.app.fullscreen)
                 App.app.topbar.actor.hide ();
 
+            bool completed_zoom = false;
+            ulong completed_id = 0;
+            completed_id = display.transitions_completed.connect (() => {
+                display.disconnect (completed_id);
+                completed_zoom = true;
+            });
+
             track_screenshot_id = App.app.properties.screenshot_placeholder.size_allocate.connect ( (alloc) => {
                 Idle.add_full (Priority.HIGH, () => {
                     App.app.topbar.actor.show ();
                     App.app.overlay_bin.set_alignment (display,
                                                        Clutter.BinAlignment.FIXED,
                                                        Clutter.BinAlignment.FIXED);
+
+                    // Don't animate x/y/width/height
+                    display.set_easing_duration (0);
                     display.x = alloc.x;
                     display.y = alloc.y;
                     display.width = alloc.width;
                     display.height = alloc.height;
+
+                    if (!completed_zoom)
+                        display.set_easing_duration (App.app.duration);
+
                     return false;
                 });
             });



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]