forked from solus-project/budgie-desktop
-
Notifications
You must be signed in to change notification settings - Fork 7
/
windowanimation.patch
133 lines (115 loc) · 4.99 KB
/
windowanimation.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
Description: Restore budgie window manager animations
Mutter v7 removed the 'scaled-gravity' effect and reworked
scaled-gravity effect but rewritten using the now expected
clutter API calls.
Author: David Mohammed <fossfreedom@ubuntu.com>
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,16 +112,20 @@ public interface Switcher: GLib.Object
}
public class MinimizeData {
- public double scale_x;
- public double scale_y;
- public double place_x;
- public double place_y;
- public double old_x;
- public double old_y;
+ public float scale_x;
+ 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, float px, float py, float ox, float oy) {
scale_x = sx;
scale_y = sy;
+ 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);
}
- 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 */
- var scale_x = (double)(icon.width / actor.width);
- var scale_y = (double)(icon.height / actor.height);
- var place_x = (double)icon.x;
- var place_y = (double)icon.y;
- var old_x = actor.x;
- var old_y = actor.y;
+ var scale_x = (float)(icon.width / actor.width);
+ 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, 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();
}
@@ -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);
- 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_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 +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 +1206,8 @@ public class BudgieWM : Meta.Plugin
}
/* Return sorted list of user open tabs */
- private List<weak Meta.Window> get_current_tabs(Meta.Display display,
- Meta.Workspace workspace,
+ private List<weak Meta.Window> get_current_tabs(Meta.Display display,
+ Meta.Workspace workspace,
bool getTabsForAllWindows)
{
List<weak Meta.Window> tabs;