Skip to content

Commit 6bab11b

Browse files
leolost2605lenemter
authored andcommitted
WindowManager/Destroy: Use async ease utils
1 parent 32feda2 commit 6bab11b

1 file changed

Lines changed: 22 additions & 46 deletions

File tree

src/WindowManager.vala

Lines changed: 22 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,68 +1405,45 @@ namespace Gala {
14051405
return;
14061406
}
14071407

1408-
if (!Meta.Prefs.get_gnome_animations ()) {
1409-
actor.opacity = 0;
1410-
destroy_completed (actor);
1408+
animate_destroy.begin (actor);
1409+
}
14111410

1412-
if (window.window_type == Meta.WindowType.NORMAL) {
1413-
Utils.clear_window_cache (window);
1414-
}
1411+
private async void animate_destroy (Meta.WindowActor actor) {
1412+
var window = actor.meta_window;
14151413

1416-
return;
1417-
}
1414+
destroying.add (actor);
14181415

14191416
switch (window.window_type) {
14201417
case Meta.WindowType.NORMAL:
1421-
var duration = AnimationDuration.CLOSE;
1422-
if (duration == 0) {
1423-
destroy_completed (actor);
1424-
return;
1425-
}
1426-
1427-
destroying.add (actor);
1428-
14291418
actor.set_pivot_point (0.5f, 0.5f);
14301419
actor.show ();
14311420

1432-
actor.save_easing_state ();
1433-
actor.set_easing_mode (Clutter.AnimationMode.LINEAR);
1434-
actor.set_easing_duration (duration);
1435-
actor.set_scale (0.8f, 0.8f);
1436-
actor.opacity = 0U;
1437-
actor.restore_easing_state ();
1421+
var builder = new TransitionBuilder (actor, AnimationDuration.CLOSE, LINEAR);
1422+
builder.add_property ("scale-x", 0.8);
1423+
builder.add_property ("scale-y", 0.8);
1424+
builder.add_property ("opacity", 0U);
1425+
yield builder.run ();
14381426

1439-
ulong destroy_handler_id = 0UL;
1440-
destroy_handler_id = actor.transitions_completed.connect (() => {
1441-
actor.disconnect (destroy_handler_id);
1442-
destroying.remove (actor);
1443-
destroy_completed (actor);
1444-
Utils.clear_window_cache (window);
1445-
});
1427+
Utils.clear_window_cache (window);
14461428
break;
1429+
14471430
case Meta.WindowType.MODAL_DIALOG:
14481431
case Meta.WindowType.DIALOG:
1449-
destroying.add (actor);
1450-
14511432
actor.set_pivot_point (0.5f, 0.5f);
1452-
actor.save_easing_state ();
1453-
actor.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
1454-
actor.set_easing_duration (150);
1455-
actor.set_scale (1.05f, 1.05f);
1456-
actor.opacity = 0U;
1457-
actor.restore_easing_state ();
14581433

1459-
ulong destroy_handler_id = 0UL;
1460-
destroy_handler_id = actor.transitions_completed.connect (() => {
1461-
actor.disconnect (destroy_handler_id);
1462-
destroying.remove (actor);
1463-
destroy_completed (actor);
1464-
});
1434+
var builder = new TransitionBuilder (actor, 150, EASE_OUT_QUAD);
1435+
builder.add_property ("scale-x", 1.05);
1436+
builder.add_property ("scale-y", 1.05);
1437+
builder.add_property ("opacity", 0U);
1438+
yield builder.run ();
14651439
break;
1440+
14661441
default:
1467-
destroy_completed (actor);
14681442
break;
14691443
}
1444+
1445+
destroying.remove (actor);
1446+
destroy_completed (actor);
14701447
}
14711448

14721449
private void unmaximize (Meta.WindowActor actor, int ex, int ey, int ew, int eh) {
@@ -1571,10 +1548,9 @@ namespace Gala {
15711548
unminimize_completed (actor);
15721549
if (end_animation (ref minimizing, actor))
15731550
minimize_completed (actor);
1574-
if (end_animation (ref destroying, actor))
1575-
destroy_completed (actor);
15761551

15771552
end_animation (ref mapping, actor);
1553+
end_animation (ref destroying, actor);
15781554
end_animation (ref unmaximizing, actor);
15791555
end_animation (ref maximizing, actor);
15801556
}

0 commit comments

Comments
 (0)