[gnome-boxes] Fix zoom in animation when starting box.



commit 4e99713a354868dd0261268844271c8a14154ccd
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Sep 5 16:45:46 2012 +0200

    Fix zoom in animation when starting box.
    
    When clicking on a box the first time it zooms to the center.
    But the second (and after) time it stays in place.
    
    Dropping the deprecated ClutterBinAlignment stuff and using the
    new clutter 1.12 ClutterActor.x/y_align properties fixes this.
    
    This also bumps the clutter requirement as this seems to only
    work on the most recent versions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683424

 configure.ac             |    2 +-
 src/app.vala             |   44 +++++++++++++++++++++-----------------------
 src/collection-view.vala |   20 +++++++++-----------
 src/machine.vala         |   32 ++++++++++++++++----------------
 src/notificationbar.vala |    2 ++
 src/selectionbar.vala    |    2 ++
 6 files changed, 51 insertions(+), 51 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2bd57bc..037c8b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,7 +42,7 @@ GOBJECT_INTROSPECTION_REQUIRE([0.9.6])
 GLIB_GSETTINGS
 
 CLUTTER_GTK_MIN_VERSION=1.3.2
-CLUTTER_MIN_VERSION=1.11.5
+CLUTTER_MIN_VERSION=1.11.14
 GLIB_MIN_VERSION=2.29.90
 GOBJECT_INTROSPECTION_MIN_VERSION=0.9.6
 GTK_MIN_VERSION=3.5.5
diff --git a/src/app.vala b/src/app.vala
index b93272e..195e64c 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -412,8 +412,8 @@ private class Boxes.App: Boxes.UI {
 
         window.key_press_event.connect_after (on_key_pressed);
 
-        stage_bin = new Clutter.BinLayout (Clutter.BinAlignment.FIXED,
-                                           Clutter.BinAlignment.FIXED);
+        stage_bin = new Clutter.BinLayout (Clutter.BinAlignment.FILL,
+                                           Clutter.BinAlignment.FILL);
         stage.set_layout_manager (stage_bin);
         stage.name = "boxes-stage";
 
@@ -425,9 +425,9 @@ private class Boxes.App: Boxes.UI {
         } catch (GLib.Error e) {
         }
         background.set_repeat (true, true);
-        stage_bin.add (background,
-                       Clutter.BinAlignment.FILL,
-                       Clutter.BinAlignment.FILL);
+        background.x_align = Clutter.ActorAlign.FILL;
+        background.y_align = Clutter.ActorAlign.FILL;
+        stage.add_child (background);
 
         sidebar = new Sidebar ();
         view = new CollectionView ();
@@ -443,10 +443,10 @@ private class Boxes.App: Boxes.UI {
         var vbox = new Clutter.BoxLayout ();
         vbox_actor.set_layout_manager (vbox);
         vbox.set_vertical (true);
+        vbox_actor.x_align = Clutter.ActorAlign.FILL;
+        vbox_actor.y_align = Clutter.ActorAlign.FILL;
 
-        stage_bin.add (vbox_actor,
-                       Clutter.BinAlignment.FILL,
-                       Clutter.BinAlignment.FILL);
+        stage.add_child (vbox_actor);
 
         var topbar_revealer = new Boxes.Revealer (true);
         topbar_revealer.name = "topbar-revealer";
@@ -462,33 +462,31 @@ private class Boxes.App: Boxes.UI {
 
         var below_bin_actor = new Clutter.Actor ();
         below_bin_actor.name = "below-bin";
-        var below_bin = new Clutter.BinLayout (Clutter.BinAlignment.FIXED,
-                                               Clutter.BinAlignment.FIXED);
+        var below_bin = new Clutter.BinLayout (Clutter.BinAlignment.FILL,
+                                               Clutter.BinAlignment.FILL);
         below_bin_actor.set_layout_manager (below_bin);
 
         vbox.pack (below_bin_actor, true, true, true, Clutter.BoxAlignment.START, Clutter.BoxAlignment.START);
 
-        below_bin.add (view.actor,
-                       Clutter.BinAlignment.FILL,
-                       Clutter.BinAlignment.FILL);
+        below_bin_actor.add_child (view.actor);
 
         var hbox_actor = new Clutter.Actor ();
         hbox_actor.name = "top-hbox";
         var hbox = new Clutter.BoxLayout ();
         hbox_actor.set_layout_manager (hbox);
+        hbox_actor.x_align = Clutter.ActorAlign.FILL;
+        hbox_actor.y_align = Clutter.ActorAlign.FILL;
 
-        below_bin.add (hbox_actor,
-                       Clutter.BinAlignment.FILL,
-                       Clutter.BinAlignment.FILL);
+        below_bin_actor.add_child (hbox_actor);
 
         overlay_bin_actor = new Clutter.Actor ();
         overlay_bin_actor.name = "overlay-bin";
-        overlay_bin = new Clutter.BinLayout (Clutter.BinAlignment.FIXED,
-                                             Clutter.BinAlignment.FIXED);
+        overlay_bin = new Clutter.BinLayout (Clutter.BinAlignment.CENTER,
+                                             Clutter.BinAlignment.CENTER);
         overlay_bin_actor.set_layout_manager (overlay_bin);
-        below_bin.add (overlay_bin_actor,
-                       Clutter.BinAlignment.FILL,
-                       Clutter.BinAlignment.FILL);
+        overlay_bin_actor.x_align = Clutter.ActorAlign.FILL;
+        overlay_bin_actor.y_align = Clutter.ActorAlign.FILL;
+        below_bin_actor.add_child (overlay_bin_actor);
 
         sidebar_revealer = new Boxes.Revealer (false);
         sidebar_revealer.name = "sidebar-revealer";
@@ -503,9 +501,9 @@ private class Boxes.App: Boxes.UI {
         content_bin_actor.set_layout_manager (content_bin);
         hbox.pack (content_bin_actor, true, true, true, Clutter.BoxAlignment.START, Clutter.BoxAlignment.START);
 
-        below_bin.add (notificationbar.actor, Clutter.BinAlignment.CENTER, Clutter.BinAlignment.START);
+        below_bin_actor.add_child (notificationbar.actor);
 
-        content_bin.add (selectionbar.actor, Clutter.BinAlignment.CENTER, Clutter.BinAlignment.END);
+        content_bin_actor.add_child (selectionbar.actor);
         content_bin_actor.add (wizard.actor);
         content_bin_actor.add (properties.actor);
 
diff --git a/src/collection-view.vala b/src/collection-view.vala
index 42af3fc..a07ee8c 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -68,13 +68,10 @@ private class Boxes.CollectionView: Boxes.UI {
                 actor.set_easing_duration (0);
                 actor.show ();
 
-                App.app.overlay_bin.set_alignment (actor,
-                                                   Clutter.BinAlignment.FIXED,
-                                                   Clutter.BinAlignment.FIXED);
                 float item_x, item_y;
                 get_item_pos (current_item, out item_x, out item_y);
-                actor.x = item_x;
-                actor.y = item_y;
+                actor.fixed_x = item_x;
+                actor.fixed_y = item_y;
                 actor.min_width = actor.natural_width = Machine.SCREENSHOT_WIDTH;
 
                 actor.set_easing_duration (App.app.duration);
@@ -101,10 +98,9 @@ private class Boxes.CollectionView: Boxes.UI {
         case UIState.CREDS:
             var actor = current_item.actor;
             if (actor.get_parent () == null) {
-                App.app.overlay_bin.add (actor,
-                                         Clutter.BinAlignment.FIXED,
-                                         Clutter.BinAlignment.FIXED);
+                App.app.overlay_bin_actor.add_child (actor);
                 actor.set_easing_mode (Clutter.AnimationMode.LINEAR);
+                actor.set_easing_duration (0);
 
                 float item_x, item_y;
                 get_item_pos (current_item, out item_x, out item_y);
@@ -113,9 +109,9 @@ private class Boxes.CollectionView: Boxes.UI {
 
             }
             actor.min_width = actor.natural_width = Machine.SCREENSHOT_WIDTH * 2;
-            App.app.overlay_bin.set_alignment (actor,
-                                               Clutter.BinAlignment.CENTER,
-                                               Clutter.BinAlignment.CENTER);
+            actor.fixed_position_set = false;
+            actor.x_align = Clutter.ActorAlign.CENTER;
+            actor.y_align = Clutter.ActorAlign.CENTER;
             actor.set_easing_duration (App.app.duration);
             break;
 
@@ -391,6 +387,8 @@ private class Boxes.CollectionView: Boxes.UI {
         gtkactor = new GtkClutter.Actor.with_contents (scrolled_window);
         gtkactor.get_widget ().get_style_context ().add_class ("boxes-bg");
         gtkactor.name = "collection-view";
+        gtkactor.x_align = Clutter.ActorAlign.FILL;
+        gtkactor.y_align = Clutter.ActorAlign.FILL;
     }
 
     private bool on_button_press_event (Gtk.Widget view, Gdk.EventButton event) {
diff --git a/src/machine.vala b/src/machine.vala
index 24905c6..c3d49f2 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -542,9 +542,9 @@ private class Boxes.MachineActor: Boxes.UI {
         if (ui_state == UIState.PROPERTIES) {
             display = new GtkClutter.Actor.with_contents (widget);
             display.name = "properties-thumbnail";
-            App.app.overlay_bin.add (display,
-                                     Clutter.BinAlignment.FILL,
-                                     Clutter.BinAlignment.FILL);
+            display.x_align = Clutter.ActorAlign.FILL;
+            display.y_align = Clutter.ActorAlign.FILL;
+            App.app.overlay_bin_actor.add_child (display);
 
             machine.display.set_enable_inputs (widget, false);
 
@@ -553,9 +553,6 @@ private class Boxes.MachineActor: Boxes.UI {
 
                 App.app.properties.screenshot_placeholder.get_allocation (out alloc);
                 App.app.topbar.actor.show ();
-                App.app.overlay_bin.set_alignment (display,
-                                                   Clutter.BinAlignment.FIXED,
-                                                   Clutter.BinAlignment.FIXED);
 
                 // We disable implicit animations while setting the
                 // properties because we don't want to animate these individually
@@ -566,10 +563,10 @@ private class Boxes.MachineActor: Boxes.UI {
                 // different.
                 var d = display.get_easing_duration ();
                 display.set_easing_duration (0);
-                display.x = alloc.x;
-                display.y = alloc.y;
-                display.width = alloc.width;
-                display.height = alloc.height;
+                display.fixed_x = alloc.x;
+                display.fixed_y = alloc.y;
+                display.min_width = display.natural_width = alloc.width;
+                display.min_height = display.natural_height = alloc.height;
                 display.set_easing_duration (d);
             };
 
@@ -609,9 +606,10 @@ private class Boxes.MachineActor: Boxes.UI {
         case UIState.DISPLAY:
             gtk_vbox.hide ();
             if (previous_ui_state == UIState.CREDS) {
-                App.app.overlay_bin.set_alignment (actor,
-                                                   Clutter.BinAlignment.FILL,
-                                                   Clutter.BinAlignment.FILL);
+                actor.x_align = Clutter.ActorAlign.FILL;
+                actor.y_align = Clutter.ActorAlign.FILL;
+                actor.natural_width_set = false;
+                actor.natural_height_set = false;
             } else {
                 if (display != null) {
                     // zoom in, back from properties
@@ -620,9 +618,11 @@ private class Boxes.MachineActor: Boxes.UI {
                     track_screenshot_id = 0;
 
                     display.set_easing_duration (App.app.duration);
-                    App.app.overlay_bin.set_alignment (display,
-                                                       Clutter.BinAlignment.FILL,
-                                                       Clutter.BinAlignment.FILL);
+                    display.x_align = Clutter.ActorAlign.FILL;
+                    display.y_align = Clutter.ActorAlign.FILL;
+                    display.fixed_position_set = false;
+                    display.min_width_set = display.natural_width_set = false;
+                    display.min_height_set = display.natural_height_set = false;
 
                     display.transitions_completed.connect (() => {
                         var widget = display.contents;
diff --git a/src/notificationbar.vala b/src/notificationbar.vala
index 4750599..97719b9 100644
--- a/src/notificationbar.vala
+++ b/src/notificationbar.vala
@@ -130,6 +130,8 @@ private class Boxes.Notificationbar: GLib.Object {
         gtk_actor.get_widget ().get_style_context ().add_class ("notificationbar");
         gtk_actor.name = "notificationbar";
         revealer.add (gtk_actor);
+        revealer.x_align = Clutter.ActorAlign.CENTER;
+        revealer.y_align = Clutter.ActorAlign.START;
     }
 
     private void show () {
diff --git a/src/selectionbar.vala b/src/selectionbar.vala
index f81428d..76ab107 100644
--- a/src/selectionbar.vala
+++ b/src/selectionbar.vala
@@ -24,6 +24,8 @@ private class Boxes.Selectionbar: GLib.Object {
         gtk_actor = new GtkClutter.Actor.with_contents (bin);
         gtk_actor.get_widget ().get_style_context ().add_class ("boxes-bg");
         gtk_actor.opacity = 0;
+        gtk_actor.x_align = Clutter.ActorAlign.CENTER;
+        gtk_actor.y_align = Clutter.ActorAlign.END;
 
         favorite_btn = new Gtk.ToggleToolButton ();
         toolbar.insert (favorite_btn, 0);



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