icon view: Refresh icon positions for manual layout on zoom change #1676
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When zoom changes on a manual layout icon view, the available area changes and can lead to some icons to either overflow or be able to go back to their actually saved position.
This is done correctly when the view is reloaded entirely, but not in response to zoom change, leading to disappearing icons (when zoom increases) or unexpected empty space (when zoom decreases).
Fix this by re-computing actual positions based on saved positions when zoom changes, to match what would actually happen when the view gets loaded.
To test this:
gsettings set org.mate.background show-desktop-icons true
gsettings set org.mate.caja.icon-view default-zoom-level large
(smaller
,small
,standard
,large
,laregr
, etc.). You can also use Edit → Preferences → Views → Defaults → Icon View → Default zoom level.Expected results (with this PR): when the zoom changes, all icons remain visible (e.g. don't overflow)
Actual results (without this PR): when zoom grows, some icons overflow and disappear. If you refresh the desktop (F5 on it) or restart Caja, they appear properly.
Known issues: given the bigger the icons the least amount can fit on the desktop, at some point when you increase the zoom factor, some icons might overlap. That didn't change, and I don't know of a real theoretical solution as there always gonna be so much space to use anyway.
Basically, this PR should make the state of the desktop after a zoom change match the one after a zoom change followed by a reload/restart.