Bug 464410

Summary: Kwin lags when changing focus between windows
Product: [Plasma] kwin Reporter: Puspam Adak <puspitaadak9876>
Component: compositingAssignee: KWin default assignee <kwin-bugs-null>
Status: REPORTED ---    
Severity: major CC: nate
Priority: NOR Flags: puspitaadak9876: X11+
puspitaadak9876: Intel+
puspitaadak9876: Mesa+
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Lag when changing focus from Qalculate

Description Puspam Adak 2023-01-17 13:26:24 UTC
Created attachment 155378 [details]
Lag when changing focus from Qalculate

SUMMARY
Kwin on X11 lags a lot when changing focus between some windows. Maybe those windows do a lot of repainting when focusing/defocusing. This effect is more seen with GTK apps with the "Default" theme.
Also seen in the maximized System Monitor & System Settings apps which have several elements visible at once.
Interestingly, this does not happen on Wayland.
I have attached a video to demonstrate this issue. The lag doesn't seem to be much worse in my situation, but think, if an application has more GUI elements, then it can freeze up Kwin for a significant amount of time.

STEPS TO REPRODUCE
1. Open a GTK app such as Qalculate, System settings or System monitor, then maximize it.
2. Try opening any panel menu (to take away focus from the application).
3. See the animation lagging.

OBSERVED RESULT
Kwin lags & hence, the animations also lag.

EXPECTED RESULT
Kwin should not lag even if an application does some graphic-intensive task during focusing/defocusing.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.15.88-1-LTS (64-bit)
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
In my opinion, this can be fixed if Kwin ignores the frames which do not come at the proper time from a particular window.