🎉 Add end-animation signal

This commit is contained in:
Simon Schneegans
2022-07-20 16:51:44 +02:00
parent a3ba8cc97d
commit 355a9eb395
3 changed files with 19 additions and 1 deletions
+8
View File
@@ -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
+3
View File
@@ -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();
}
});
+8 -1
View File
@@ -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() {