Skip to content

Never show progress bar when moving files to trash on Windows to prevent losing focus #105788

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Nallebeorn
Copy link
Contributor

@Nallebeorn Nallebeorn commented Apr 26, 2025

Closes #99552. This also affects the Godot editor itself when deleting files on Windows.

Hides all UI when sending files to the recycle bin on Windows. With the previous flags, we were still requesting a progress bar to be displayed. It typically wouldn't be visible because trashing even large files is often nearly instant (though I could see it when deleting a large directory with many files), but even when not visibly appearing the progress dialog would still momentarily steal focus from the main window.

See https://learn.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shfileopstructw#fof_no_ui

Based on the implementations for other platforms, I'm assuming that showing a system progress bar is not needed or desired, so changing this in order to avoid the focus steal should be okay.

@Nallebeorn Nallebeorn requested a review from a team as a code owner April 26, 2025 09:20
@Zireael07
Copy link
Contributor

trashing even large files is nearly instant

Counter argument: deleting even a moderately large file on a slow disk (old HDD or a bad USB)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OS.move_to_trash() makes window lose and gain focus
3 participants