kwin/effects/presentwindows
Erik Kurzinger 30ad58f559 [effects/presentwindows] Avoid potential freeze during fill-gaps
Summary:
When using the natural layout algorithm with the fill-gaps option, a small
error (less than one) is introduced in windows' aspect ratio each time they are
enlarged due to floating-point roundoff.

Currently, the algorithm computes the width and height enlargement factors and
then attempts to enlarge in each of the four possible directions, repeating
until it can't enlarge any windows any further.  Hence, this aspect ratio error
can be multiplied by up to four. Especially for small, long, and narrow
windows, this can result in a total error of greater than one by the end of
that loop iteration. If this occurs, on subsequent iterations the height
enlargement factor might then be computed as negative violating some of the
core assumptions of the algorithm and resulting in the loop iterating endlessly
until one of the window dimensions overflows, freezing the program for up to
several minutes.

To fix this, the height enlargement factor should be re-computed based on the
new width each time the window is enlarged, ensuring the error introduced in
the aspect ratio never exceeds one.

BUG: 364709
BUG: 380865
BUG: 368811

FIXED-IN: 5.15.0

Test Plan:
The most reliable way to reproduce the freeze seems to be to activate the
desktop-grid effect while a tool-tip window is fading in.
Ensure desktop-grid is configured to use present windows, and that present
windows is configured to use the natural layout algorithm with the fill gaps
option selected.

The freeze is still intermittent, but using this method should be able to be
triggered within about 10 tries without this fix.
After applying the fix, the freeze has never been observed.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: graesslin, kwin, zzag

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16278
2018-10-20 18:37:45 +03:00
..
CMakeLists.txt Use SERVICE_TYPES parameter to kcoreaddons_desktop_to_json() 2015-12-09 23:42:45 +00:00
main.qml Don't hardcode Present Windows close button size 2014-08-11 12:27:21 +02:00
presentwindows.cpp [effects/presentwindows] Avoid potential freeze during fill-gaps 2018-10-20 18:37:45 +03:00
presentwindows.h [effects] Ignore previous state of WindowForceBlurRole 2018-06-19 15:23:41 +03:00
presentwindows.kcfg [effects] Use arg="true" in the kcfg files 2017-04-15 10:03:34 +02:00
presentwindows_config.cpp [effects] Use arg="true" in the kcfg files 2017-04-15 10:03:34 +02:00
presentwindows_config.desktop SVN_SILENT made messages (.desktop file) - always resolve ours 2018-07-23 05:24:40 +02:00
presentwindows_config.h [kwin/effects] Use generated dbus interface to reconfigure effects 2014-03-25 15:49:19 +01:00
presentwindows_config.ui Use KShortcutsEditor directly instead of subclass 2013-09-09 06:57:06 +02:00
presentwindows_proxy.cpp recreate presentwindows grids from desktopgrid 2015-09-14 21:01:01 +02:00
presentwindows_proxy.h recreate presentwindows grids from desktopgrid 2015-09-14 21:01:01 +02:00
presentwindowsconfig.kcfgc Use KConfigXT in PresentWindows Effect 2012-09-14 10:39:28 +02:00