Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add swap desktop icons when they move too close #635

Closed
wants to merge 1 commit into from
Closed

Add swap desktop icons when they move too close #635

wants to merge 1 commit into from

Conversation

zzhiyi
Copy link

@zzhiyi zzhiyi commented Sep 11, 2016

When you move icons on desktop near existent icons at a very close distance, caja allow that behavior for now. However this kind of behavior can make desktop icons very messy because one can stack on another. This PR prevents icon moving when they're too close by switching their positions.
@lukefromdc I built it again. The typo was my bad. Made a stupid mistake. Sorry. And I want to create a new PR as I don't want to add another commit that says "fix typo" :)

raveit65 referenced this pull request Oct 12, 2016
Add --disable-libunique configuration option for GTK3 builds. This builds a port from libunique to GtkApplication. keep GTK2 builds unchanged

Caja can now be build with GTK2 and libunique, GTK3 and libunique, or GTK3 without libunique using GtkApplication instead

GtkApplication port  Based on cherrypicked nautilus commits from
GNOME/nautilus@a8481ee
main: adapt to GtkApplication changes
through
GNOME/nautilus@c3382e0
application: move nautilus_application_new() to its own function

GTK3/GtkApplication builds:  add --force-desktop option
This is useful for other DE's

All: StartupNotify=false in .desktop files, as caja never connects to notification daemons and in GtkApplication builds this causes busy spinning curors
@lukefromdc
Copy link
Member

Got this error on attempting to build against caja master as of 10-14-2016 10PM EDT:

caja-icon-container.c:6376: undefined reference toeel_accessibility_set_atk_object_return'`

probably needs rework due to commit 99a9c6e which was needed to get Orca to work

@lukefromdc
Copy link
Member

I just got this to work, turned out my prior file-based test was invalid. I rebased and merged to a branch on my own repo https://github.com/lukefromdc/caja/tree/dev-swapicons, it built fine and is running fine right now.

lukefromdc added a commit that referenced this pull request Oct 18, 2016
@lukefromdc
Copy link
Member

lukefromdc commented Oct 18, 2016

Got it to build and run, created a rebased branch at https://github.com/mate-desktop/caja/tree/dev-swapicons2 but found that at least in GTK 3.22 the icons don't switch positions, they just act the same as before. You can get around some rebasing nastiness by merging my branch back to a new branch in your own repo and working on it there if you want.

@zzhiyi
Copy link
Author

zzhiyi commented Oct 18, 2016

I think I will look into it only when I have more free time. You're free to merge the rebased branch and close this MR.

@raveit65
Copy link
Member

You're free to merge the rebased branch and close this MR.

We can't merge something which do nothing :)

@lukefromdc
Copy link
Member

Should I close this?

@lukefromdc
Copy link
Member

lukefromdc commented Oct 19, 2016

I just found this does in fact work-but only if the icons are dropped almost exactly on top of oneanother. They can still overlap, they need to be within about 20px or so of a perfect match. This is enough to prevent an exact stack of the icons but that's about it unless the minimum distance is opened up to perhaps 48px, the typical icon size on the desktop, maybe a bit more.

EDIT: also requires "keep aligned" to be enabled, I assume that is intentional?

@lukefromdc
Copy link
Member

OK, the issues here seem to be problems with how "keep aligned" works. When "keep aligned" is selected, icons are held to gridded positions horizontally but not vertically. Thus, if and only if keep aligned is used on the desktop, this will swap them if dropped into the same column from separate columns-if they are at almost exactly the same height. If the heights differ by more than about 10px, they will still end up overlapping, presumably same as before.

This is because if you move an icon vertically onto another icon, staying in the same column, the lack of a vertical version of keep aligned means unless they are dropped within that 10px or so of a perfect center to center match, the swap function is not triggered. Increasing that center to center distance could fix this

lukefromdc added a commit that referenced this pull request Oct 19, 2016
@lukefromdc
Copy link
Member

Just got this to work in the vertical plane too with
d3810ce to
https://github.com/mate-desktop/caja/tree/dev-swapicons2

opening a new PR for this because it is works, is rebased on today's master and is ready to go

@lukefromdc
Copy link
Member

#663
is this PR with the hardcoded fix for vertical icon swapping

@zzhiyi
Copy link
Author

zzhiyi commented Oct 21, 2016

Re: EDIT: also requires "keep aligned" to be enabled, I assume that is intentional?

Yes. It's intentional. I want that users could do anything they want such as overlapping icons when keep aligned is disabled.

@lukefromdc
Copy link
Member

I ran into some ugly and old issues with keep aligned (that making this unconditional would not solve). When keep aligned is selected and icons move, or with this code when icons are swapped, the stored icon positions are not updated because the "file" variable used in GVFS to store them isn't used in the keep aligned functions. Thus when Caja is restarted, the swapped (auto-moved) icon comes back up in its old position.

This is an old Nautilus bug. In Caja's case, deselecting, then reselecting keep aligned will realign the icons and bring back swapped positions but has to be done every time Caja is started. Whatever that does, if it were done when Caja was started assuming keep aligned is selected, it would solve the entire problem, allowing the rebased PR to be merged and fixing the existing keep aligned issue as well. More discussion of this in #663 , the rebased and patched PR

@lukefromdc
Copy link
Member

Closing as there is no simple way to save the results of this so it does not get reverted on the next start of caja. Even a simple use of "keep aligned" requires selecting the entire desktop, moving all the icons together, and then moving them back to write the filenames and positions to the file where they are saved. The functions modified in these PR's have no access to the necessary information, so no easy way to fix this.

@raveit65 raveit65 closed this Aug 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants