Avoids needlessly waking up the disk or network when the window isn't active.
CCBUG: 398612
elvisangelaccio | |
sitter |
Dolphin |
Avoids needlessly waking up the disk or network when the window isn't active.
CCBUG: 398612
Verified that it updates once it gets focus
Verified the timer stops when window doesn't have focus
Has the side-effect that when you have multiple windows visible at the same time (e.g. two windows next to each other) that only the active one will update its free space info live
Creating a MountPointObserver will eventually query KMountPoint which statvfs the file system and potentially block. So, perhaps this should be changed to not destroy but just tell it to "not update"? or have a refcount for "active listeners" as well? oof..
Even pressing Alt+Tab causes the window briefly to lose focus (X doing a short grab), so this needs some further work
Also doesn't do anything wrt tabs, if you have multiple tabs open, all of them still update, even when not current
Lint Skipped |
Unit Tests Skipped |
https://doc.qt.io/qt-5/qwidget.html#visibleRegion would be more reliable and also work for not visible tabs I think.
That said, I am not sure how that behaves for semi-transparent windows, so Elvis' point probably stands. A conservative approach might be to only stop polling when minimized? Then the window is definitely not visible.
https://doc.qt.io/qt-5/qwidget.html#visibleRegion would be more reliable and also work for not visible tabs I think.
Good idea, will try. It won't help with "obscured" windows, though, but yeah, the minimize state is probably definitely something to take into account (though I hardly ever minimize windows, they're just buried under 20 layers of windows here :D)