🔧 Do not import the ShaderFactory in the preferences process

This commit is contained in:
Simon Schneegans
2023-09-08 20:45:58 +02:00
parent 3f05c946ec
commit 14cd1db7e9
25 changed files with 205 additions and 180 deletions
+8 -7
View File
@@ -18,7 +18,8 @@ import Gio from 'gi://Gio';
const _ = imports.gettext.domain('burn-my-windows').gettext;
import {ShaderFactory} from '../ShaderFactory.js';
const ShaderFactory =
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
//////////////////////////////////////////////////////////////////////////////////////////
// This effect is a homage to the good old Compiz days. However, it is implemented //
@@ -38,7 +39,7 @@ export default class Effect {
// GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each
// newly created shader instance.
constructor() {
this.shaderFactory = new ShaderFactory(this.getNick(), (shader) => {
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
// We import Clutter in this function as it is not available in the preferences
// process. This creator function of the ShaderFactory is only called within GNOME
// Shell's process.
@@ -78,7 +79,7 @@ export default class Effect {
// ---------------------------------------------------------------------------- metadata
// The effect is available on all GNOME Shell versions supported by this extension.
getMinShellVersion() {
static getMinShellVersion() {
return [3, 36];
}
@@ -86,13 +87,13 @@ export default class Effect {
// required. It should match the prefix of the settings keys which store whether the
// effect is enabled currently (e.g. '*-enable-effect'), and its animation time
// (e.g. '*-animation-time').
getNick() {
static getNick() {
return 'fire';
}
// This will be shown in the sidebar of the preferences dialog as well as in the
// drop-down menus where the user can choose the effect.
getLabel() {
static getLabel() {
return _('Fire');
}
@@ -100,7 +101,7 @@ export default class Effect {
// This is called by the preferences dialog whenever a new effect profile is loaded. It
// binds all user interface elements to the respective settings keys of the profile.
bindPreferences(dialog) {
static bindPreferences(dialog) {
// Bind all properties.
dialog.bindAdjustment('fire-animation-time');
@@ -136,7 +137,7 @@ export default class Effect {
// The getActorScale() is called from extension.js to adjust the actor's size during the
// animation. This is useful if the effect requires drawing something beyond the usual
// bounds of the actor. This only works for GNOME 3.38+.
getActorScale(settings) {
static getActorScale(settings) {
return {x: 1.0, y: 1.0};
}