From 355a9eb395ee15b72ac48d3ff1eaf685c600b41f Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Wed, 20 Jul 2022 16:51:44 +0200 Subject: [PATCH] :tada: Add end-animation signal --- docs/changelog.md | 8 ++++++++ extension.js | 3 +++ src/Shader.js | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 4be9f53..57a4bd9 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,13 @@ # Changelog of the Burn-My-Windows Extension +## [Burn My Windows 19](https://github.com/schneegans/Burn-My-Windows/releases/tag/v19) + +**Release Date:** TBD + +#### Enhancements + +* On GNOME, effects can now execute code whenever an animation ended. This is useful for cleaning up resources. + ## [Burn My Windows 18](https://github.com/schneegans/Burn-My-Windows/releases/tag/v18) **Release Date:** 2022-06-30 diff --git a/extension.js b/extension.js index 067ab2e..207a8ce 100644 --- a/extension.js +++ b/extension.js @@ -229,6 +229,7 @@ class Extension { const shader = actor.get_effect('burn-my-windows-effect'); if (shader) { actor.remove_effect(shader); + shader.endAnimation(); shader.returnToFactory(); } } @@ -385,6 +386,7 @@ class Extension { const oldShader = actor.get_effect('burn-my-windows-effect'); if (oldShader) { actor.remove_effect(oldShader); + oldShader.endAnimation(); oldShader.returnToFactory(); } @@ -520,6 +522,7 @@ class Extension { const oldShader = actor.get_effect('burn-my-windows-effect'); if (oldShader) { actor.remove_effect(oldShader); + oldShader.endAnimation(); oldShader.returnToFactory(); } }); diff --git a/src/Shader.js b/src/Shader.js index 2ae1ad0..630cb25 100644 --- a/src/Shader.js +++ b/src/Shader.js @@ -48,7 +48,8 @@ var Shader = GObject.registerClass( Signals: { 'begin-animation': {param_types: [Gio.Settings.$gtype, GObject.TYPE_BOOLEAN, Clutter.Actor.$gtype]}, - 'update-animation': {param_types: [GObject.TYPE_DOUBLE]} + 'update-animation': {param_types: [GObject.TYPE_DOUBLE]}, + 'end-animation': {} } }, class Shader extends Shell.GLSLEffect { // -------------------------------------------- @@ -99,6 +100,12 @@ var Shader = GObject.registerClass( this._progress = progress; } + // This will just emit the end-animation signal. It can be used to clean up any + // resources required during the animation. + endAnimation() { + this.emit('end-animation'); + } + // This is called by the constructor. This means, it's only called when the // effect is used for the first time. vfunc_build_pipeline() {