[gnome-boxes] Add allocate_actor_noanim herlper
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Add allocate_actor_noanim herlper
- Date: Mon, 19 Nov 2012 10:01:39 +0000 (UTC)
commit ef50d47864e2d162754f6015ffb35db1a21ceaf6
Author: Alexander Larsson <alexl redhat com>
Date: Fri Nov 16 16:13:46 2012 +0100
Add allocate_actor_noanim herlper
https://bugzilla.gnome.org/show_bug.cgi?id=688473
src/app.vala | 7 +++----
src/machine.vala | 3 +--
src/util-app.vala | 11 +++++++++++
3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 9b0ad43..c7cab21 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -768,10 +768,9 @@ private class Boxes.App: Boxes.UI {
var actor = machine.actor;
if (actor.get_parent () == null) {
App.app.overlay_bin_actor.add_child (actor);
- actor.set_easing_duration (0);
-
- Clutter.ActorBox box = { x, y, x + Machine.SCREENSHOT_WIDTH, y + Machine.SCREENSHOT_HEIGHT * 2};
- actor.allocate (box, 0);
+ allocate_actor_no_animation (actor, x, y,
+ Machine.SCREENSHOT_WIDTH,
+ Machine.SCREENSHOT_HEIGHT * 2);
}
actor.show ();
actor.set_easing_mode (Clutter.AnimationMode.LINEAR);
diff --git a/src/machine.vala b/src/machine.vala
index 1757c14..63f402b 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -748,8 +748,7 @@ private class Boxes.MachineActor: Boxes.UI {
if (zoom) {
- Clutter.ActorBox box = { 0, 0, width, height};
- thumbnail.allocate (box, 0);
+ allocate_actor_no_animation (thumbnail, 0, 0, width, height);
// Temporarily hide toolbar in fullscreen so that the the animation
// actor doesn't get pushed down before zooming to the sidebar
diff --git a/src/util-app.vala b/src/util-app.vala
index 28a1ede..7067e0b 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -98,6 +98,17 @@ namespace Boxes {
return obj->stringval;
}
+ // This can be used to ensure a specific initial allocation for a previously unallocated actor
+ public void allocate_actor_no_animation (Clutter.Actor actor,
+ float x, float y,
+ float width, float height) {
+ var old_duration = actor.get_easing_duration ();
+ actor.set_easing_duration (0);
+ Clutter.ActorBox box = { x, y, x + width, y + height};
+ actor.allocate (box, 0);
+ actor.set_easing_duration (old_duration);
+ }
+
public void fade_actor (Clutter.Actor actor, uint opacity) {
if (opacity != 0)
actor.show ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]