Bug 478097

Summary: In WindowHeap-based effects, expanded windows can't decide their position when switching the desktop, which makes them twitch
Product: [Plasma] kwin Reporter: Zhora Zmeikin <rs5334819>
Component: effects-window-managementAssignee: KWin default assignee <kwin-bugs-null>
Severity: normal CC: nate
Priority: NOR Keywords: qt6
Version: 5.90.0   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 6.1
Attachments: Demonstration

Description Zhora Zmeikin 2023-12-05 08:17:51 UTC
Created attachment 163893 [details]

If you switch to overview or "desktop grid" mode and place one full-screen and one regular window on the same desktop, you can notice how the windows twitch when you switch to that desktop. You can notice how they can't decide on their position on the screen for a while. You can see it more clearly on the video.

1. Create at least 2 desktops.
2. Open any program in the expanded state on the first desktop.
3. Open any second program on the first desktop.
4. Go to view mode or desktop grid and switch between desktops (in desktop grid this is done via Ctrl + Meta + Left/Right)

The windows twitch, constantly trying to assume different positions.

Linux/KDE Plasma: KDE Neon (Unstable), Wayland
KDE Plasma Version: 5.90.0
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.0
Comment 1 fanzhuyifan 2024-02-19 11:55:59 UTC
Git commit c3cda8b62ad3825883826bdd1928c8761aeb026d by Yifan Zhu.
Committed on 19/02/2024 at 11:46.
Pushed by fanzhuyifan into branch 'master'.

effects/overview: implement new layout algorithm

Replace old "closest" and "natural" layout algorithms with new layout
algorithm. The new layout algorithm tries to
- use screen space efficiently, given diverse geometries of windows
- be aesthetically pleasing
- and minimize movement of windows from initial positions.

More concretely, find a layered layout, where each layer, or strip, is a
row or column. Ensure that different strips have similar widths, and use
binary search to find a packing with similar aspect ratio to the layout
area. Within each strip, minimize horizontal movement (for rows) or
vertical movement (for columns) of windows.

Run time is O(n) (up to log factors), where n is the number of windows.
Related: bug 450263, bug 477833, bug 477830, bug 453749

M  +6    -27   src/plugins/overview/kcm/overvieweffectkcm.ui
M  +0    -3    src/plugins/overview/overviewconfig.kcfg
M  +0    -14   src/plugins/overview/overvieweffect.cpp
M  +0    -6    src/plugins/overview/overvieweffect.h
M  +0    -1    src/plugins/overview/qml/main.qml
M  +436  -399  src/plugins/private/expolayout.cpp
M  +204  -28   src/plugins/private/expolayout.h
M  +2    -2    src/plugins/private/qml/WindowHeap.qml
M  +4    -25   src/plugins/windowview/kcm/windowvieweffectkcm.ui
M  +0    -1    src/plugins/windowview/qml/main.qml
M  +0    -3    src/plugins/windowview/windowviewconfig.kcfg
M  +0    -14   src/plugins/windowview/windowvieweffect.cpp
M  +0    -6    src/plugins/windowview/windowvieweffect.h