📝 Add some comments to the KWin JS file

This commit is contained in:
Simon Schneegans
2022-11-05 05:35:56 +01:00
parent 90f2eb0492
commit c2736781c6
+17 -14
View File
@@ -48,13 +48,16 @@ class %EFFECT_CLASS% {
return color; return color;
} }
// This is called when the effect is loaded and whenever the settings of the effect
// are changed by the user.
loadConfig() { loadConfig() {
this.duration = animationTime(effect.readConfig('Duration', 1000)); this.duration = animationTime(effect.readConfig('Duration', 1000));
%ON_SETTINGS_CHANGE% %ON_SETTINGS_CHANGE%
} }
static isScaleWindow(window) { static shouldAnimateWindow(window) {
// We don't want to animate most of plasmashell's windows, yet, some // We don't want to animate most of plasmashell's windows, yet, some
// of them we want to, for example, Task Manager Settings window. // of them we want to, for example, Task Manager Settings window.
// The problem is that all those window share single window class. // The problem is that all those window share single window class.
@@ -107,7 +110,7 @@ class %EFFECT_CLASS% {
if (effects.hasActiveFullScreenEffect) { if (effects.hasActiveFullScreenEffect) {
return; return;
} }
if (!%EFFECT_CLASS%.isScaleWindow(window)) { if (!%EFFECT_CLASS%.shouldAnimateWindow(window)) {
return; return;
} }
if (!window.visible) { if (!window.visible) {
@@ -122,7 +125,7 @@ class %EFFECT_CLASS% {
%ON_ANIMATION_BEGIN% %ON_ANIMATION_BEGIN%
window.scaleInAnimation = animate({ window.bmwInAnimation = animate({
window: window, window: window,
curve: QEasingCurve.Linear, curve: QEasingCurve.Linear,
duration: this.duration, duration: this.duration,
@@ -142,7 +145,7 @@ class %EFFECT_CLASS% {
if (effects.hasActiveFullScreenEffect) { if (effects.hasActiveFullScreenEffect) {
return; return;
} }
if (!%EFFECT_CLASS%.isScaleWindow(window)) { if (!%EFFECT_CLASS%.shouldAnimateWindow(window)) {
return; return;
} }
if (!window.visible || window.skipsCloseAnimation) { if (!window.visible || window.skipsCloseAnimation) {
@@ -151,9 +154,9 @@ class %EFFECT_CLASS% {
if (effect.isGrabbed(window, Effect.WindowClosedGrabRole)) { if (effect.isGrabbed(window, Effect.WindowClosedGrabRole)) {
return; return;
} }
if (window.scaleInAnimation) { if (window.bmwInAnimation) {
cancel(window.scaleInAnimation); cancel(window.bmwInAnimation);
delete window.scaleInAnimation; delete window.bmwInAnimation;
} }
this.setupForcedRoles(window); this.setupForcedRoles(window);
@@ -161,7 +164,7 @@ class %EFFECT_CLASS% {
%ON_ANIMATION_BEGIN% %ON_ANIMATION_BEGIN%
window.scaleOutAnimation = animate({ window.bmwOutAnimation = animate({
window: window, window: window,
curve: QEasingCurve.Linear, curve: QEasingCurve.Linear,
duration: this.duration, duration: this.duration,
@@ -179,15 +182,15 @@ class %EFFECT_CLASS% {
slotWindowDataChanged(window, role) { slotWindowDataChanged(window, role) {
if (role == Effect.WindowAddedGrabRole) { if (role == Effect.WindowAddedGrabRole) {
if (window.scaleInAnimation && effect.isGrabbed(window, role)) { if (window.bmwInAnimation && effect.isGrabbed(window, role)) {
cancel(window.scaleInAnimation); cancel(window.bmwInAnimation);
delete window.scaleInAnimation; delete window.bmwInAnimation;
this.cleanupForcedRoles(window); this.cleanupForcedRoles(window);
} }
} else if (role == Effect.WindowClosedGrabRole) { } else if (role == Effect.WindowClosedGrabRole) {
if (window.scaleOutAnimation && effect.isGrabbed(window, role)) { if (window.bmwOutAnimation && effect.isGrabbed(window, role)) {
cancel(window.scaleOutAnimation); cancel(window.bmwOutAnimation);
delete window.scaleOutAnimation; delete window.bmwOutAnimation;
this.cleanupForcedRoles(window); this.cleanupForcedRoles(window);
} }
} }