Bug 478097 - In WindowHeap-based effects, expanded windows can't decide their position when switching the desktop, which makes them twitch
Summary: In WindowHeap-based effects, expanded windows can't decide their position whe...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-window-management (show other bugs)
Version: 5.90.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2023-12-05 08:17 UTC by Zhora Zmeikin
Modified: 2024-02-24 02:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 6.1


Attachments
Demonstration (3.34 MB, video/mp4)
2023-12-05 08:17 UTC, Zhora Zmeikin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zhora Zmeikin 2023-12-05 08:17:51 UTC
Created attachment 163893 [details]
Demonstration

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.

STEPS TO REPRODUCE
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)

OBSERVED RESULT
The windows twitch, constantly trying to assume different positions.

SOFTWARE/OS VERSIONS
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

https://invent.kde.org/plasma/kwin/-/commit/c3cda8b62ad3825883826bdd1928c8761aeb026d