BlueGit

timfa kwin-marble

Repaint full screen when marble animations end; restore starts invisible (no stale mini window)

timfa Tim Falken · pushed by timfa

Authored 2026-11-02 · 2 weeks ago

Hash
bf639719f0da3a655a64a777415a5dda477ee3c9
Parent
e7b1df9f
2 files changed +22 −2
kwin6_effect_marble/contents/code/main.js +8 −0
@@ -235,6 +235,8 @@ class BurnMyWindowsMarbleEffect {
235 235 }
236 236
237 237 slotAnimationEnded(window, id) {
238 // marble is drawn outside the window's own damage region: repaint all on every end
239 this.repaintAll();
238 240 if (!window || !window.bmwFallPending) return; // first end = marble marker (ids arrive as 0)
239 241 window.bmwFallPending = false;
240 242 // free fall from rest: InQuad = t^2 = constant acceleration, d = 0.5 g t^2
@@ -247,6 +249,12 @@ class BurnMyWindowsMarbleEffect {
247 249 });
248 250 }
249 251
252 repaintAll() {
253 try { effects.addRepaintFull(); } catch (e) {
254 if (!this.bmwWarned) { this.bmwWarned = true; console.warn("marble: addRepaintFull unavailable: " + e); }
255 }
256 }
257
250 258 slotWindowDataChanged(window, role) {
251 259 if (role == Effect.WindowAddedGrabRole) {
252 260 if (window.bmwInAnimation && effect.isGrabbed(window, role)) {
@@ -235,6 +235,8 @@ class BurnMyWindowsMarbleEffect {
235 }
235 }
236
236
237 slotAnimationEnded(window, id) {
237 slotAnimationEnded(window, id) {
238 // marble is drawn outside the window's own damage region: repaint all on every end
239 this.repaintAll();
238 if (!window || !window.bmwFallPending) return; // first end = marble marker (ids arrive as 0)
240 if (!window || !window.bmwFallPending) return; // first end = marble marker (ids arrive as 0)
239 window.bmwFallPending = false;
241 window.bmwFallPending = false;
240 // free fall from rest: InQuad = t^2 = constant acceleration, d = 0.5 g t^2
242 // free fall from rest: InQuad = t^2 = constant acceleration, d = 0.5 g t^2
@@ -247,6 +249,12 @@ class BurnMyWindowsMarbleEffect {
247 });
249 });
248 }
250 }
249
251
252 repaintAll() {
253 try { effects.addRepaintFull(); } catch (e) {
254 if (!this.bmwWarned) { this.bmwWarned = true; console.warn("marble: addRepaintFull unavailable: " + e); }
255 }
256 }
257
250 slotWindowDataChanged(window, role) {
258 slotWindowDataChanged(window, role) {
251 if (role == Effect.WindowAddedGrabRole) {
259 if (role == Effect.WindowAddedGrabRole) {
252 if (window.bmwInAnimation && effect.isGrabbed(window, role)) {
260 if (window.bmwInAnimation && effect.isGrabbed(window, role)) {
kwin6_effect_marble_minimize/contents/code/main.js +14 −2
@@ -273,18 +273,23 @@ class BurnMyWindowsMarbleMinimizeEffect {
273 273 animations: [{ type: Effect.ShaderUniform, fragmentShader: this.shader, uniform: "uProgress", from: 1.0, to: 0.0 }]
274 274 });
275 275 this.fallAnims(window, f, -1);
276 window.bmwFadeInAnimation = animate({ window: window, curve: QEasingCurve.InExpo, duration: 80,
277 animations: [{ type: Effect.Opacity, from: 0.0, to: 1.0 }] });
276 278 }
277 279
278 280 stopAll(window) {
279 281 window.bmwMode = null;
280 282 for (const k of ["bmwMinAnimation", "bmwMarbleDone", "bmwXAnimation", "bmwYAnimation", "bmwScaleAnimation",
281 "bmwTailAnimation", "bmwUnminAnimation"]) {
283 "bmwTailAnimation", "bmwUnminAnimation", "bmwFadeInAnimation"]) {
282 284 if (window[k]) { cancel(window[k]); delete window[k]; }
283 285 }
286 this.repaintAll();
284 287 }
285 288
286 289 // KWin reports ids as 0 here, so we use our own state + end times.
287 290 slotAnimationEnded(window, id) {
291 // marble is drawn outside the window's own damage region: repaint all on every end
292 this.repaintAll();
288 293 if (!window || !window.bmwMode) return;
289 294 if (window.bmwSegEnd && Date.now() < window.bmwSegEnd) return; // another animation ended
290 295 const f = window.bmwFall;
@@ -299,10 +304,17 @@ class BurnMyWindowsMarbleMinimizeEffect {
299 304 { type: Effect.Opacity, from: 0.0, to: 0.0 }]
300 305 });
301 306 window.bmwMode = "tail"; window.bmwSegEnd = Date.now() + 250 - 8;
307 this.repaintAll();
302 308 } else if (window.bmwMode == "tail") { // now stop the shader; window is hidden
303 309 window.bmwMode = null;
304 310 if (window.bmwMinAnimation) { cancel(window.bmwMinAnimation); delete window.bmwMinAnimation; }
305 try { effects.addRepaintFull(); } catch (e) {}
311 this.repaintAll();
312 }
313 }
314
315 repaintAll() {
316 try { effects.addRepaintFull(); } catch (e) {
317 if (!this.bmwWarned) { this.bmwWarned = true; console.warn("marble: addRepaintFull unavailable: " + e); }
306 318 }
307 319 }
308 320
@@ -273,18 +273,23 @@ class BurnMyWindowsMarbleMinimizeEffect {
273 animations: [{ type: Effect.ShaderUniform, fragmentShader: this.shader, uniform: "uProgress", from: 1.0, to: 0.0 }]
273 animations: [{ type: Effect.ShaderUniform, fragmentShader: this.shader, uniform: "uProgress", from: 1.0, to: 0.0 }]
274 });
274 });
275 this.fallAnims(window, f, -1);
275 this.fallAnims(window, f, -1);
276 window.bmwFadeInAnimation = animate({ window: window, curve: QEasingCurve.InExpo, duration: 80,
277 animations: [{ type: Effect.Opacity, from: 0.0, to: 1.0 }] });
276 }
278 }
277
279
278 stopAll(window) {
280 stopAll(window) {
279 window.bmwMode = null;
281 window.bmwMode = null;
280 for (const k of ["bmwMinAnimation", "bmwMarbleDone", "bmwXAnimation", "bmwYAnimation", "bmwScaleAnimation",
282 for (const k of ["bmwMinAnimation", "bmwMarbleDone", "bmwXAnimation", "bmwYAnimation", "bmwScaleAnimation",
281 "bmwTailAnimation", "bmwUnminAnimation"]) {
283 "bmwTailAnimation", "bmwUnminAnimation", "bmwFadeInAnimation"]) {
282 if (window[k]) { cancel(window[k]); delete window[k]; }
284 if (window[k]) { cancel(window[k]); delete window[k]; }
283 }
285 }
286 this.repaintAll();
284 }
287 }
285
288
286 // KWin reports ids as 0 here, so we use our own state + end times.
289 // KWin reports ids as 0 here, so we use our own state + end times.
287 slotAnimationEnded(window, id) {
290 slotAnimationEnded(window, id) {
291 // marble is drawn outside the window's own damage region: repaint all on every end
292 this.repaintAll();
288 if (!window || !window.bmwMode) return;
293 if (!window || !window.bmwMode) return;
289 if (window.bmwSegEnd && Date.now() < window.bmwSegEnd) return; // another animation ended
294 if (window.bmwSegEnd && Date.now() < window.bmwSegEnd) return; // another animation ended
290 const f = window.bmwFall;
295 const f = window.bmwFall;
@@ -299,10 +304,17 @@ class BurnMyWindowsMarbleMinimizeEffect {
299 { type: Effect.Opacity, from: 0.0, to: 0.0 }]
304 { type: Effect.Opacity, from: 0.0, to: 0.0 }]
300 });
305 });
301 window.bmwMode = "tail"; window.bmwSegEnd = Date.now() + 250 - 8;
306 window.bmwMode = "tail"; window.bmwSegEnd = Date.now() + 250 - 8;
307 this.repaintAll();
302 } else if (window.bmwMode == "tail") { // now stop the shader; window is hidden
308 } else if (window.bmwMode == "tail") { // now stop the shader; window is hidden
303 window.bmwMode = null;
309 window.bmwMode = null;
304 if (window.bmwMinAnimation) { cancel(window.bmwMinAnimation); delete window.bmwMinAnimation; }
310 if (window.bmwMinAnimation) { cancel(window.bmwMinAnimation); delete window.bmwMinAnimation; }
305 try { effects.addRepaintFull(); } catch (e) {}
311 this.repaintAll();
312 }
313 }
314
315 repaintAll() {
316 try { effects.addRepaintFull(); } catch (e) {
317 if (!this.bmwWarned) { this.bmwWarned = true; console.warn("marble: addRepaintFull unavailable: " + e); }
306 }
318 }
307 }
319 }
308
320