Bug 435423 - Morphing popups effect does not cross-fade on X11
Summary: Morphing popups effect does not cross-fade on X11
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-various (show other bugs)
Version: 5.21.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression, wayland
Depends on:
Blocks:
 
Reported: 2021-04-06 13:42 UTC by Antonio Orefice
Modified: 2022-09-07 13:45 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.26


Attachments
Video showing the issue as it is right now (1.04 MB, video/x-matroska)
2021-08-05 15:58 UTC, Antonio Orefice
Details
Full morphingpopup.js that discards crossfades when the previous texture is wrong or missing. (4.11 KB, application/x-javascript)
2021-08-05 16:01 UTC, Antonio Orefice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio Orefice 2021-04-06 13:42:06 UTC
THIS SEEMS 
*NOT*
A DUPLICATE OF https://bugs.kde.org/show_bug.cgi?id=416048 to me.

SUMMARY
When using morphing popups, the content of the popup is erased and does not morph, does not X-fade.

STEPS TO REPRODUCE
1. Hover a taskbar icon
2. move the pointer to the next one

OBSERVED RESULT
On oxygen, the popup becomes transparent then fades to opacity, no Xfade.
* https://www.youtube.com/watch?v=ZmiBsvPpZ_s

On breeze, the popup does not become transparent like on oxygen, but still no Xfade.
* https://www.youtube.com/watch?v=-3mEqmMo9zI

EXPECTED RESULT
The intended behaviour, the popup should just Xfade from an image to the next and should not becomes compèletely transparent, like happens now with oxygen.
https://www.youtube.com/watch?v=jDByfncO568

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.80.0
KDE Plasma Version: 5.21.3
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2
Comment 1 Nate Graham 2021-04-07 16:10:48 UTC
What kind of graphics hardware do you have?
Comment 2 Antonio Orefice 2021-04-07 16:58:57 UTC
Hi, i tested woth same results on intel haswell and intel ivybridge.
Maximize effect does x-fades.
Do you think is an hardware/driver issue?
Comment 3 Antonio Orefice 2021-04-20 09:41:11 UTC
Meantime, i removed the "CrossFadePrevious" part from the morphingpopup.js:
        if (!couldRetarget) {
            window.fadeAnimation = animate({
                window: window,
                duration: morphingEffect.duration,
                animations: [{
                    type: Effect.CrossFadePrevious,
                    to: 1.0,
                    from: 0.0
                }]
            });
        }

and now i've no more flashes or fades from transparencies.
Still no Xfades, but at least is not broken.
Comment 4 Antonio Orefice 2021-08-05 15:58:36 UTC
Created attachment 140544 [details]
Video showing the issue as it is right now

Since the fixing of this bug:
https://bugs.kde.org/show_bug.cgi?id=439689

This one seems to be, altough partially, fixed.
Weird flashes on oxygen theme are gone, but crossfade acts weirdly, and when it does, the window crossfades from transparency.

I made a slowmotion video to show what happens:

Crossfade works as expected when the pointer hovers from the first icon to the kdialog taskbar thumbnail.
Then something wrird happens, pointer go to libreoffice thumbnail and the crossfare still works, but the previous texture it uses is still the one from konsole.



*--> (1) It seems that the effect takes the "previous" texture of the crossfade <--*
*--> only when the new *size* of the popup window has changed.                  <--*



Anyway, even if I've not understood very well the logic in morphingpopups.js, i made a little workaround to it so that crossfade now works properly when the popup changes size, and simply skip the morphing code alltogheter when it stay the same size.

That way, we can avoid fading from a transparent texture or from a wrong one:
------------------------------------------------------------------------------
+       if (oldGeometry.width != newGeometry.width ||
+                oldGeometry.height != newGeometry.height) {
			if (!couldRetarget) {
				window.fadeAnimation = animate({
					window: window,
					duration: morphingEffect.duration,
					animations: [{
						type: Effect.CrossFadePrevious,
						to: 1.0,
						from: 0.0
					}]
				});
			}
+		}
------------------------------------------------------------------------------
Comment 5 Antonio Orefice 2021-08-05 16:01:30 UTC
Created attachment 140545 [details]
Full morphingpopup.js that discards crossfades when the previous texture is wrong or missing.

Full morphingpopup.js that discards crossfades when the previous texture is wrong or missing.
Comment 6 Antonio Orefice 2021-10-19 10:21:02 UTC
Used to work with some glitches in plasma 5.22.5 due to this being fixed:
https://bugs.kde.org/show_bug.cgi?id=439689
Now the same bug has returned and this is following.
Comment 7 Nate Graham 2022-04-01 20:09:31 UTC
*** Bug 446375 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2022-04-01 20:09:57 UTC
Can reproduce 100% on Wayland, but not X11, interestingly.
Comment 9 Nate Graham 2022-04-06 19:32:54 UTC
*** Bug 446375 has been marked as a duplicate of this bug. ***
Comment 10 Antonio Orefice 2022-04-07 07:10:55 UTC
(In reply to Nate Graham from comment #8)
> Can reproduce 100% on Wayland, but not X11, interestingly.

I have to point out that this bug is not about wayland not sliding and morphing the shape of the popup, which works correctly on X11, but that the Crossfade effect does not work on X11.
** ->> "Effect.CrossFadePrevious"
Comment 11 Marco Martin 2022-09-07 10:16:40 UTC
Git commit 31d1f885ce184b54690d44c5fcd4bb7384f6f0a3 by Marco Martin.
Committed on 07/09/2022 at 10:16.
Pushed by mart into branch 'master'.

Restore the crossfade effect

This enables again the crossfade between the old window picture and the new one in the maximize and morphingpopup effects.
It does that with the OffScreenEffect redirect() feature.
Related: bug 439689

M  +1    -0    autotests/integration/effects/maximize_animation_test.cpp
M  +22   -0    src/effects.cpp
M  +1    -0    src/effects.h
M  +10   -22   src/effects/blendchanges/blendchanges.cpp
M  +3    -3    src/effects/blendchanges/blendchanges.h
M  +25   -12   src/effects/maximize/package/contents/code/maximize.js
M  +23   -17   src/effects/morphingpopups/package/contents/code/morphingpopups.js
M  +2    -0    src/events.cpp
M  +2    -0    src/internalwindow.cpp
M  +12   -5    src/libkwineffects/kwinanimationeffect.cpp
M  +1    -1    src/libkwineffects/kwinanimationeffect.h
M  +29   -0    src/libkwineffects/kwineffects.h
M  +156  -51   src/libkwineffects/kwinoffscreeneffect.cpp
M  +46   -13   src/libkwineffects/kwinoffscreeneffect.h
M  +1    -0    src/window.cpp
M  +6    -0    src/window.h
M  +1    -0    src/x11window.cpp
M  +2    -0    src/xdgshellwindow.cpp

https://invent.kde.org/plasma/kwin/commit/31d1f885ce184b54690d44c5fcd4bb7384f6f0a3