Skip to content

Commit 2762d51

Browse files
committed
Simplify
1 parent b708a66 commit 2762d51

File tree

1 file changed

+24
-37
lines changed

1 file changed

+24
-37
lines changed

src/WindowManager.vala

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,7 @@ namespace Gala {
10811081
kill_window_effects (actor);
10821082
minimizing.add (actor);
10831083

1084+
var scale_x = 0.0, scale_y = 0.0;
10841085
Mtk.Rectangle icon = {};
10851086
if (actor.get_meta_window ().get_icon_geometry (out icon)) {
10861087
// Fix icon position and size according to ui scaling factor.
@@ -1090,44 +1091,31 @@ namespace Gala {
10901091
icon.width = Utils.scale_to_int (icon.width, ui_scale);
10911092
icon.height = Utils.scale_to_int (icon.height, ui_scale);
10921093

1093-
var scale_x = (double) icon.width / actor.width;
1094-
var scale_y = (double) icon.height / actor.height;
1095-
float anchor_x = (float)(actor.x - icon.x) / (icon.width - actor.width);
1096-
float anchor_y = (float)(actor.y - icon.y) / (icon.height - actor.height);
1097-
actor.set_pivot_point (anchor_x, anchor_y);
1098-
1099-
new PropertyAnimator (
1100-
actor,
1101-
AnimationDuration.HIDE,
1102-
Clutter.AnimationMode.EASE_IN_EXPO,
1103-
{
1104-
{ "scale-x", typeof (double), null, scale_x },
1105-
{ "scale-y", typeof (double), null, scale_y },
1106-
{ "opacity", typeof (uint), null, 0u },
1107-
},
1108-
(actor) => {
1109-
minimize_completed ((Meta.WindowActor) actor);
1110-
minimizing.remove ((Meta.WindowActor) actor);
1111-
}
1094+
actor.set_pivot_point (
1095+
(actor.x - icon.x) / (icon.width - actor.width),
1096+
(actor.y - icon.y) / (icon.height - actor.height)
11121097
);
1098+
1099+
scale_x = (double) icon.width / actor.width;
1100+
scale_y = (double) icon.height / actor.height;
11131101
} else {
11141102
actor.set_pivot_point (0.5f, 1.0f);
1115-
1116-
new PropertyAnimator (
1117-
actor,
1118-
AnimationDuration.HIDE,
1119-
Clutter.AnimationMode.EASE_IN_EXPO,
1120-
{
1121-
{ "scale-x", typeof (double), null, 0.0 },
1122-
{ "scale-y", typeof (double), null, 0.0 },
1123-
{ "opacity", typeof (uint), null, 0u },
1124-
},
1125-
(actor) => {
1126-
minimize_completed ((Meta.WindowActor) actor);
1127-
minimizing.remove ((Meta.WindowActor) actor);
1128-
}
1129-
);
11301103
}
1104+
1105+
new PropertyAnimator (
1106+
actor,
1107+
AnimationDuration.HIDE,
1108+
Clutter.AnimationMode.EASE_IN_EXPO,
1109+
{
1110+
{ "scale-x", typeof (double), null, scale_x },
1111+
{ "scale-y", typeof (double), null, scale_y },
1112+
{ "opacity", typeof (uint), null, 0u }
1113+
},
1114+
(actor) => {
1115+
minimize_completed ((Meta.WindowActor) actor);
1116+
minimizing.remove ((Meta.WindowActor) actor);
1117+
}
1118+
);
11311119
}
11321120

11331121
private void maximize (Meta.WindowActor actor, int ex, int ey, int ew, int eh) {
@@ -1529,7 +1517,7 @@ namespace Gala {
15291517
(float) (-ey + offset_y * (1.0f / scale_y - 1.0f) + old_rect_size_change.y),
15301518
0.0f
15311519
);
1532-
actor.set_scale (1.0f / scale_x, 1.0f / scale_y);
1520+
actor.set_scale (1.0 / scale_x, 1.0 / scale_y);
15331521

15341522
new PropertyAnimator (
15351523
actor,
@@ -1539,8 +1527,7 @@ namespace Gala {
15391527
{ "scale-x", typeof (double), null, 1.0 },
15401528
{ "scale-y", typeof (double), null, 1.0 },
15411529
{ "translation-x", typeof (float), null, 0.0f },
1542-
{ "translation-y", typeof (float), null, 0.0f },
1543-
{ "translation-z", typeof (float), null, 0.0f },
1530+
{ "translation-y", typeof (float), null, 0.0f }
15441531
},
15451532
(actor) => {
15461533
unmaximizing.remove ((Meta.WindowActor) actor);

0 commit comments

Comments
 (0)