Skip to content

Commit

Permalink
Set x and y positions correctly for window animations
Browse files Browse the repository at this point in the history
  • Loading branch information
fossfreedom committed Oct 16, 2020
1 parent c0b2a6a commit 0c037ae
Showing 1 changed file with 42 additions and 12 deletions.
54 changes: 42 additions & 12 deletions debian/patches/windowanimation.patch
Expand Up @@ -7,9 +7,11 @@ Bug: https://github.com/solus-project/budgie-desktop/issues/2040
Forwarded: TBD
Last-Update: 2020-10-15

Index: budgie-desktop-10.5.1+git20200824/src/wm/wm.vala
===================================================================
--- budgie-desktop-10.5.1+git20200824.orig/src/wm/wm.vala
+++ budgie-desktop-10.5.1+git20200824/src/wm/wm.vala
@@ -112,20 +112,16 @@ public interface Switcher: GLib.Object
@@ -112,16 +112,20 @@ public interface Switcher: GLib.Object
}

public class MinimizeData {
Expand All @@ -23,21 +25,30 @@ Last-Update: 2020-10-15
+ public float scale_y;
+ public float anchor_x;
+ public float anchor_y;
+ public float place_x;
+ public float place_y;
+ public float old_x;
+ public float old_y;

- public MinimizeData(double sx, double sy, double px, double py, double ox, double oy) {
+ public MinimizeData(float sx, float sy, float ax, float ay) {
+ public MinimizeData(float sx, float sy, float ax, float ay, float px, float py, float ox, float oy) {
scale_x = sx;
scale_y = sy;
- place_x = px;
- place_y = py;
- old_x = ox;
- old_y = oy;
+ anchor_x = ax;
+ anchor_y = ay;
place_x = px;
place_y = py;
old_x = ox;
@@ -820,7 +824,7 @@ public class BudgieWM : Meta.Plugin
finalize_animations(actor as Meta.WindowActor);
}
}

@@ -851,19 +847,18 @@ public class BudgieWM : Meta.Plugin
- const int MINIMIZE_TIMEOUT = 195;
+ const int MINIMIZE_TIMEOUT = 225;

public override void minimize(Meta.WindowActor actor)
{
@@ -851,19 +855,24 @@ public class BudgieWM : Meta.Plugin
actor.transitions_completed.connect(minimize_done);

/* Save the minimize state for later restoration */
Expand All @@ -51,22 +62,37 @@ Last-Update: 2020-10-15
+ var scale_y = (float)(icon.height / actor.height);
+ var anchor_x = (float)(actor.x - icon.x) / (icon.width - actor.width);
+ var anchor_y = (float)(actor.y - icon.y) / (icon.height - actor.height);
+ var place_x = (float)icon.x;
+ var place_y = (float)icon.y;
+ var old_x = (float)actor.x;
+ var old_y = (float)actor.y;

- MinimizeData d = new MinimizeData(scale_x, scale_y, place_x, place_y, old_x, old_y);
+ MinimizeData d = new MinimizeData(scale_x, scale_y, anchor_x, anchor_y);
+ MinimizeData d = new MinimizeData(scale_x, scale_y, anchor_x, anchor_y, place_x, place_y, old_x, old_y);

actor.set_data("_minimize_data", d);
- actor.set("opacity", 0U, "scale-gravity", Clutter.Gravity.NORTH_WEST,
- "x", d.place_x, "y", d.place_y, "scale-x",
- d.scale_x, "scale-y", d.scale_y);
+ actor.set_scale(d.scale_x, d.scale_y);
+ actor.set_x((float)icon.x);
+ actor.set_y((float)icon.y);
+ actor.opacity = 0U;
+ actor.set_content_gravity(Clutter.ContentGravity.TOP_LEFT);
+ actor.set_pivot_point(anchor_x, anchor_y);
actor.restore_easing_state();
}

@@ -896,9 +891,9 @@ public class BudgieWM : Meta.Plugin
@@ -876,7 +885,7 @@ public class BudgieWM : Meta.Plugin
finalize_animations(actor as Meta.WindowActor);
}

- const int UNMINIMIZE_TIMEOUT = 170;
+ const int UNMINIMIZE_TIMEOUT = 200;

/**
* Handle unminimize animation
@@ -896,9 +905,11 @@ public class BudgieWM : Meta.Plugin

finalize_animations(actor);

Expand All @@ -75,22 +101,26 @@ Last-Update: 2020-10-15
- d.scale_x, "scale-y", d.scale_y);
+ actor.set_pivot_point (d.anchor_x, d.anchor_y);
+ actor.set_scale (d.scale_x, d.scale_y);
+ actor.set_x(d.place_x);
+ actor.set_y(d.place_y);
+ actor.opacity = 0U;

actor.show();

@@ -906,8 +901,8 @@ public class BudgieWM : Meta.Plugin
@@ -906,8 +917,10 @@ public class BudgieWM : Meta.Plugin
actor.set_easing_mode(Clutter.AnimationMode.EASE_OUT_QUAD);
actor.set_easing_duration(UNMINIMIZE_TIMEOUT);

- actor.set("scale-x", 1.0, "scale-y", 1.0, "opacity", 255U,
- "x", d.old_x, "y", d.old_y);
+ actor.set_scale (1.0f, 1.0f);
+ actor.opacity = 255U;
+ actor.set_x(d.old_x);
+ actor.set_y(d.old_y);

actor.transitions_completed.connect(unminimize_done);
state_map.insert(actor, AnimationState.UNMINIMIZE);
@@ -1193,8 +1188,8 @@ public class BudgieWM : Meta.Plugin
@@ -1193,8 +1206,8 @@ public class BudgieWM : Meta.Plugin
}

/* Return sorted list of user open tabs */
Expand Down

0 comments on commit 0c037ae

Please sign in to comment.