From 314090e0d02627176967f6b42b630c847b31fc1a Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Tue, 11 Jan 2022 19:43:47 +0100 Subject: [PATCH] :recycle: Use unified shader names --- src/FireEffect.js | 10 ++++------ src/MatrixEffect.js | 13 +++++-------- src/TRexEffect.js | 8 +++----- src/TVEffect.js | 13 ++++++------- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/FireEffect.js b/src/FireEffect.js index e0c5458..a6542aa 100644 --- a/src/FireEffect.js +++ b/src/FireEffect.js @@ -28,7 +28,7 @@ const utils = Me.imports.src.utils; ////////////////////////////////////////////////////////////////////////////////////////// // The shader class for this effect is registered further down in this file. -let FireShader = null; +let Shader = null; // The effect class is completely static. It can be used to get some metadata (like the // effect's name or supported GNOME Shell versions), to initialize the respective page of @@ -99,7 +99,7 @@ var FireEffect = class FireEffect { // This is called from extension.js whenever a window is closed with this effect. static createShader(settings) { - return new FireShader(settings); + return new Shader(settings); } // This is also called from extension.js. It is used to tweak the ongoing transitions of @@ -116,8 +116,7 @@ var FireEffect = class FireEffect { } }; - // If there's a transition in progress, we re-target these transitions so that the - // window is neither scaled nor faded. + // We re-target these transitions so that the window is neither scaled nor faded. tweakTransition('opacity', 255); tweakTransition('scale-x', 1); tweakTransition('scale-y', 1); @@ -225,8 +224,7 @@ if (utils.isInShellProcess()) { const Clutter = imports.gi.Clutter; const shaderSnippets = Me.imports.src.shaderSnippets; - FireShader = GObject.registerClass({Properties: {}, Signals: {}}, - class FireShader extends Clutter.ShaderEffect { + Shader = GObject.registerClass({}, class Shader extends Clutter.ShaderEffect { _init(settings) { super._init({shader_type: Clutter.ShaderType.FRAGMENT_SHADER}); diff --git a/src/MatrixEffect.js b/src/MatrixEffect.js index bd23bd2..f4156e0 100644 --- a/src/MatrixEffect.js +++ b/src/MatrixEffect.js @@ -20,7 +20,7 @@ const Me = imports.misc.extensionUtils.getCurrentExtension(); const utils = Me.imports.src.utils; ////////////////////////////////////////////////////////////////////////////////////////// -// The MatrixShader multiplies a grid of random letters with some gradients which are // +// The Matrix shader multiplies a grid of random letters with some gradients which are // // moving from top to bottom. The speed of the moving gradients is chosen randomly. // // Also, there is a random delay making the gradients not drop all at the same time. // // This effect is not available on GNOME 3.3x, due to the limitation described in the // @@ -28,7 +28,7 @@ const utils = Me.imports.src.utils; ////////////////////////////////////////////////////////////////////////////////////////// // The shader class for this effect is registered further down in this file. -let MatrixShader = null; +let Shader = null; // The effect class is completely static. It can be used to get some metadata (like the // effect's name or supported GNOME Shell versions), to initialize the respective page of @@ -83,7 +83,7 @@ var MatrixEffect = class MatrixEffect { // This is called from extension.js whenever a window is closed with this effect. static createShader(settings) { - return new MatrixShader(settings); + return new Shader(settings); } // This is also called from extension.js. It is used to tweak the ongoing transitions of @@ -100,8 +100,7 @@ var MatrixEffect = class MatrixEffect { } }; - // If there's a transition in progress, we re-target these transitions so that the - // window is neither scaled nor faded. + // We re-target these transitions so that the window is neither scaled nor faded. tweakTransition('opacity', 255); tweakTransition('scale-x', 1); tweakTransition('scale-y', 1); @@ -120,9 +119,7 @@ if (utils.isInShellProcess()) { const {Clutter, GdkPixbuf, Cogl} = imports.gi; const shaderSnippets = Me.imports.src.shaderSnippets; - - MatrixShader = GObject.registerClass({Properties: {}, Signals: {}}, - class MatrixShader extends Clutter.ShaderEffect { + Shader = GObject.registerClass({}, class Shader extends Clutter.ShaderEffect { _init(settings) { super._init({shader_type: Clutter.ShaderType.FRAGMENT_SHADER}); diff --git a/src/TRexEffect.js b/src/TRexEffect.js index d38ebe4..96e44b8 100644 --- a/src/TRexEffect.js +++ b/src/TRexEffect.js @@ -26,7 +26,7 @@ const utils = Me.imports.src.utils; ////////////////////////////////////////////////////////////////////////////////////////// // The shader class for this effect is registered further down in this file. -let TRexShader = null; +let Shader = null; // The effect class is completely static. It can be used to get some metadata (like the // effect's name or supported GNOME Shell versions), to initialize the respective page of @@ -81,7 +81,7 @@ var TRexEffect = class TRexEffect { // This is called from extension.js whenever a window is closed with this effect. static createShader(settings) { - return new TRexShader(settings); + return new Shader(settings); } // This is also called from extension.js. It is used to tweak the ongoing transitions of @@ -119,9 +119,7 @@ if (utils.isInShellProcess()) { const {Clutter, GdkPixbuf, Cogl} = imports.gi; const shaderSnippets = Me.imports.src.shaderSnippets; - - TRexShader = GObject.registerClass({Properties: {}, Signals: {}}, - class TRexShader extends Clutter.ShaderEffect { + Shader = GObject.registerClass({}, class Shader extends Clutter.ShaderEffect { _init(settings) { super._init({shader_type: Clutter.ShaderType.FRAGMENT_SHADER}); diff --git a/src/TVEffect.js b/src/TVEffect.js index b38f523..d97f8a7 100644 --- a/src/TVEffect.js +++ b/src/TVEffect.js @@ -20,13 +20,13 @@ const Me = imports.misc.extensionUtils.getCurrentExtension(); const utils = Me.imports.src.utils; ////////////////////////////////////////////////////////////////////////////////////////// -// The TVShader hides the actor by making it first transparent from top and // -// bottom towards the middle and then hiding the resulting line from left and right // -// towards the center. // +// This effect hides the actor by making it first transparent from top and bottom // +// towards the middle and then hiding the resulting line from left and right towards // +// the center. // ////////////////////////////////////////////////////////////////////////////////////////// // The shader class for this effect is registered further down in this file. -let TVShader = null; +let Shader = null; // The effect class is completely static. It can be used to get some metadata (like the // effect's name or supported GNOME Shell versions), to initialize the respective page of @@ -78,7 +78,7 @@ var TVEffect = class TVEffect { // This is called from extension.js whenever a window is closed with this effect. static createShader(settings) { - return new TVShader(settings); + return new Shader(settings); } // This is also called from extension.js. It is used to tweak the ongoing transitions of @@ -114,8 +114,7 @@ if (utils.isInShellProcess()) { const Clutter = imports.gi.Clutter; const shaderSnippets = Me.imports.src.shaderSnippets; - TVShader = GObject.registerClass({Properties: {}, Signals: {}}, - class TVShader extends Clutter.ShaderEffect { + Shader = GObject.registerClass({}, class Shader extends Clutter.ShaderEffect { _init(settings) { super._init({shader_type: Clutter.ShaderType.FRAGMENT_SHADER});