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

Avoid double handling of rename in the file system dock #91112

Merged
merged 1 commit into from
May 7, 2024

Conversation

RandomShaper
Copy link
Member

@RandomShaper RandomShaper commented Apr 24, 2024

Fixes #90473.
Bugsquad edit: Fixes #91648

In that issue, certain change in DisplayServerWindows seems to be the cause of the issue on Windows. However, the report is about Linux. The fact that the issue is cross-platform makes sense if you think about what this PR does.

The floating text box used for rename can be confirmed via closing the popup containing it or via actually confirming the input. Since the latter involves the former, there's some code to avoid handling the user will twice. However, it's such a brittle deambiguation mechanism; namely, if certain keys are down, we assume the text input was already handled. It only makes sense that such a handling is subject to break with subtle changes in input event management across display servers. In fact, that's the problem: the rename operation is attempted twice because the current mechanism fails to block the second event.

This PR reimplements the involved handlers in a more robust way so the issue is gone and very unlikely to inadvertedly reappear again. That said, I'm not super happy with how ad hoc this is even in the new version. Maybe LineEdit could have a property, such as submit_on_parent_close that makes the intended behavior an opt-in feature of it. This PR fixes the issue in the meantime anyway.

Lastly, Tree seems to have a similar deambiguation code, but that one seems to still work with the current DisplayServer implementations. That said, it'd warrant similar love. (CC @bruvzg, that may want to review this PR and later improve the state of affairs.)

2024-05-01: This is now based on #91361, which fixes the underlying issue on Windows. However, sine this issue was not Window-specific and I'd still want to have a more solid mechanism here, I've reworked this PR doing so.

@RandomShaper RandomShaper added this to the 4.3 milestone Apr 24, 2024
@RandomShaper RandomShaper requested a review from a team as a code owner April 24, 2024 15:26
@bruvzg bruvzg self-requested a review April 24, 2024 15:40
@KoBeWi
Copy link
Member

KoBeWi commented Apr 29, 2024

Apparently there is another regression 🤔 Closing name edit with Escape will accept it. It's the same before this PR though, but not in dev5.

@RandomShaper
Copy link
Member Author

Fixed. In the end, some not-very-elegant check has been needed. At least, it's based on an action and not on specific keys. I guess it's good enough until the time where this all is implemented as as first-class feature.

@akien-mga akien-mga added the bug label Apr 30, 2024
@KoBeWi
Copy link
Member

KoBeWi commented Apr 30, 2024

Renaming in tree mode is now broken.

@RandomShaper
Copy link
Member Author

Pushed with a different approach. (Please see the added note to the PR description.)

@RandomShaper RandomShaper force-pushed the fix_double_confirm branch 2 times, most recently from d2d9dc2 to 141d2e8 Compare May 1, 2024 11:43
Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work correctly now, tested on Windows.

@RandomShaper
Copy link
Member Author

Thank you very much for your continuous help testing this!

@RandomShaper RandomShaper force-pushed the fix_double_confirm branch 2 times, most recently from 55b3093 to fb30c1f Compare May 3, 2024 11:42
platform/windows/display_server_windows.cpp Outdated Show resolved Hide resolved
@akien-mga
Copy link
Member

Can be rebased to avoid the confusion of including two commits when one is already in master.

@akien-mga akien-mga merged commit 316c4d5 into godotengine:master May 7, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

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.

Crash on folder capitalization change Renaming a file sometimes shows an error popup
4 participants