Bug 477830 - In WindowHeap-based effects, closing windows using "Natural" algorithm causes erratic rearranging of windows
Summary: In WindowHeap-based effects, closing windows using "Natural" algorithm causes...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-window-management (show other bugs)
Version: 5.90.0
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-01 11:40 UTC by patrick.jansky
Modified: 2024-02-24 02:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 6.1
Sentry Crash Report:


Attachments
Erratic behavior in overview (1.54 MB, video/webm)
2023-12-01 11:40 UTC, patrick.jansky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description patrick.jansky 2023-12-01 11:40:24 UTC
Created attachment 163695 [details]
Erratic behavior in overview

SUMMARY
When you have lots of windows open and close some them in the overview the remaining windows rearrange themselves in an erratic an quite unpredictable way. GNOME solves this by only rearranging the remaining windows after a timeout and has more of a "the windows bellow the closed one move up to fill the void way". Looking at the video in KDE I can not really predict how the windows will move and as this happens after every windows you close. 


STEPS TO REPRODUCE
1. Open a lot of windows (20 or so suffice)
2. Go into overview 
3. Close some of those windows in the overview

OBSERVED RESULT
Erratic and jarring rearranging of the remaining windows after every window closed. This looks weird and is disorientating as you know longer know where the other windows will be after the rearrangement

EXPECTED RESULT
Smoother rearranging with a more predictable pattern. GNOME does this really well for reference


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch with KDE unstable Repo/Plasma 5.90.0
(available in About System)
KDE Plasma Version: 5.90.0
KDE Frameworks Version: 5.246
Qt Version: 6.6.1

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2023-12-01 18:03:35 UTC
FWIW not a Qt 6 issue; this is how it's basically always worked.
Comment 2 fanzhuyifan 2024-02-19 11:55:51 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 478097, 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