📝 Add even more comments

This commit is contained in:
Simon Schneegans
2022-01-10 06:02:21 +01:00
parent 63515a3d8d
commit 458a382f16
5 changed files with 42 additions and 16 deletions
+9 -4
View File
@@ -57,7 +57,9 @@ var FireEffect = class FireEffect {
// -------------------------------------------------------------------- API for prefs.js
// This is called by the preferences dialog.
// This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the
// preferences dialog.
static initPreferences(dialog) {
// Add the settings page to the builder.
@@ -95,13 +97,14 @@ var FireEffect = class FireEffect {
// ---------------------------------------------------------------- API for extension.js
// This is called from extension.js whenever a window is closed with this effect.
static createShader(settings) {
return new FireShader(settings);
}
// If there's a transition in progress, we re-target these transitions so that the
// window is neither scaled nor faded.
// This is also called from extension.js. It is used to tweak the ongoing transitions of
// the actor - usually windows are faded to transparency and scaled down slightly by
// GNOME Shell. Here, we modify this behavior as well as the transition duration.
static tweakTransitions(actor, settings) {
const animationTime = settings.get_int('fire-animation-time');
@@ -113,6 +116,8 @@ 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.
tweakTransition('opacity', 255);
tweakTransition('scale-x', 1);
tweakTransition('scale-y', 1);
+9 -4
View File
@@ -57,7 +57,9 @@ var MatrixEffect = class MatrixEffect {
// -------------------------------------------------------------------- API for prefs.js
// This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the
// preferences dialog.
static initPreferences(dialog) {
// Add the settings page to the builder.
@@ -79,13 +81,14 @@ var MatrixEffect = class MatrixEffect {
// ---------------------------------------------------------------- API for extension.js
// This is called from extension.js whenever a window is closed with this effect.
static createShader(settings) {
return new MatrixShader(settings);
}
// If there's a transition in progress, we re-target these transitions so that the
// window is neither scaled nor faded.
// This is also called from extension.js. It is used to tweak the ongoing transitions of
// the actor - usually windows are faded to transparency and scaled down slightly by
// GNOME Shell. Here, we modify this behavior as well as the transition duration.
static tweakTransitions(actor, settings) {
const animationTime = settings.get_int('matrix-animation-time');
@@ -97,6 +100,8 @@ 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.
tweakTransition('opacity', 255);
tweakTransition('scale-x', 1);
tweakTransition('scale-y', 1);
+9 -4
View File
@@ -55,6 +55,9 @@ var TRexEffect = class TRexEffect {
// -------------------------------------------------------------------- API for prefs.js
// This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the
// preferences dialog.
static initPreferences(dialog) {
// Add the settings page to the builder.
@@ -76,13 +79,14 @@ var TRexEffect = class TRexEffect {
// ---------------------------------------------------------------- API for extension.js
// This is called from extension.js whenever a window is closed with this effect.
static createShader(settings) {
return new TRexShader(settings);
}
// If there's a transition in progress, we re-target these transitions so that the
// window is neither scaled nor faded.
// This is also called from extension.js. It is used to tweak the ongoing transitions of
// the actor - usually windows are faded to transparency and scaled down slightly by
// GNOME Shell. Here, we modify this behavior as well as the transition duration.
static tweakTransitions(actor, settings) {
const animationTime = settings.get_int('trex-animation-time');
@@ -94,8 +98,9 @@ var TRexEffect = class TRexEffect {
}
};
// For this effect, we slightly increase the window's scale as part of the warp
// effect.
const warp = 0.5 * settings.get_double('claw-scratch-warp');
tweakTransition('opacity', 255);
tweakTransition('scale-x', 1.0 + warp);
tweakTransition('scale-y', 1.0 + warp);
+8 -4
View File
@@ -55,7 +55,9 @@ var TVEffect = class TVEffect {
// -------------------------------------------------------------------- API for prefs.js
// This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the
// preferences dialog.
static initPreferences(dialog) {
// Add the settings page to the builder.
@@ -74,13 +76,14 @@ var TVEffect = class TVEffect {
// ---------------------------------------------------------------- API for extension.js
// This is called from extension.js whenever a window is closed with this effect.
static createShader(settings) {
return new TVShader(settings);
}
// If there's a transition in progress, we re-target these transitions so that the
// window is neither scaled nor faded.
// This is also called from extension.js. It is used to tweak the ongoing transitions of
// the actor - usually windows are faded to transparency and scaled down slightly by
// GNOME Shell. Here, we modify this behavior as well as the transition duration.
static tweakTransitions(actor, settings) {
const animationTime = settings.get_int('tv-animation-time');
@@ -92,6 +95,7 @@ var TVEffect = class TVEffect {
}
};
// For this effect, we scale the window only vertically.
tweakTransition('opacity', 255);
tweakTransition('scale-x', 1);
tweakTransition('scale-y', 0.5);
+7
View File
@@ -46,18 +46,25 @@ function isGTK4() {
return Gtk.get_major_version() == 4;
}
// This method returns 'gtk3' or 'gtk4' depending on the currently used gtk version.
function getGTKString() {
return isGTK4() ? 'gtk4' : 'gtk3';
}
// This method returns true if called in GNOME Shell's process, false if called in the
// preferences process.
function isInShellProcess() {
return window.global && global.stage;
}
// This method returns true if the current GNOME Shell version matches the given
// arguments.
function shellVersionIs(major, minor) {
return GS_MAJOR == major && GS_MINOR == minor;
}
// This method returns true if the current GNOME Shell version is at least as high as the
// given arguments.
function shellVersionIsAtLeast(major, minor) {
if (GS_MAJOR > major) {
return true;