Skip to content

Restore bounds for Quick Open and all dialogs that inherit AcceptDialog#117829

Open
actforjason wants to merge 1 commit intogodotengine:masterfrom
actforjason:contrib/restore-dialog
Open

Restore bounds for Quick Open and all dialogs that inherit AcceptDialog#117829
actforjason wants to merge 1 commit intogodotengine:masterfrom
actforjason:contrib/restore-dialog

Conversation

@actforjason
Copy link
Copy Markdown

@actforjason actforjason commented Mar 25, 2026

This PR adds persistence for dialog bounds (position and size) for the Quick Open, Scene Tree dialogs etc. similar to how it is handled in the Create Dialog, as a lightweight alternative for #106648
Close godotengine/godot-proposals#5005

The previous PR introduced a session_id to make dialog bounds restoration work in-game. However, that approach still has some unresolved issues and maybe requires further adjustments to integrate.

This PR proposes a less intrusive solution that aligns with the current implementation of Create Dialog, allowing this feature to be completed sooner. A more comprehensive refactor, either of the existing approach or at the project level, can be considered in the future.

47af9e74-a80e-4be7-966e-a65dad829287

@actforjason actforjason requested review from a team as code owners March 25, 2026 15:03
@Nintorch Nintorch added this to the 4.x milestone Mar 25, 2026
@actforjason actforjason changed the title Restore bounds for Quick Open and Scene Tree dialogs Restore bounds for Quick Open and more dialogs Mar 26, 2026
@actforjason actforjason marked this pull request as draft March 26, 2026 09:52
youfch added a commit to youfch/godot that referenced this pull request Mar 27, 2026
@actforjason actforjason force-pushed the contrib/restore-dialog branch from 0850531 to 47a2f8c Compare March 27, 2026 04:30
@actforjason actforjason marked this pull request as ready for review March 27, 2026 04:31
@actforjason
Copy link
Copy Markdown
Author

@ArchercatNEO I implement storage and restoration of window bounds in the base class AcceptDialog of all dialogs to avoid setting them one by one. Do you think this method is ideal?

@actforjason actforjason changed the title Restore bounds for Quick Open and more dialogs Restore bounds for Quick Open and all dialogs that inherit AcceptDialog Mar 27, 2026
@actforjason actforjason requested a review from a team as a code owner March 27, 2026 04:47
@actforjason actforjason force-pushed the contrib/restore-dialog branch from cd295fc to 16d6e8c Compare March 27, 2026 04:49
@ArchercatNEO
Copy link
Copy Markdown
Contributor

@ArchercatNEO I implement storage and restoration of window bounds in the base class AcceptDialog of all dialogs to avoid setting them one by one. Do you think this method is ideal?

I implemented session_id based on instances of windows instead of classes of windows for a reason: I see that you’re using class_name as a key (which is good, it means each class has a different key) but if we ever try to make two different dialogs that both use the same class, they would share their window bounds. I believe this is a restriction that could lead to strange behaviour (like a window being restored where an unrelated window was last closed) but if you believe this is not a concern I would say this is a reasonable implementation.

Another reason I wanted to implement session_id is that on Wayland since windows cannot position themselves we cannot restore windows with this method. There exists a protocol (xdg-session-management) which allows the compositor to restore windows if they are assigned an id (with the same restrictions as my own implementation of session_id) but since this is a lightweight PR and conforms to current implementations I don’t to want to hold this against this PR.

However, there is a problem with using EditorSettings in scene. We’re not allowed to make scene depend on editor (not even behind #ifdef TOOLS) . This is the reason I re-created my own version of them in DisplayServer. I don’t believe EditorSettings are fundamental to the approach here, you need to find somewhere else to put the file management.

@actforjason
Copy link
Copy Markdown
Author

I see that you’re using class_name as a key (which is good, it means each class has a different key) but if we ever try to make two different dialogs that both use the same class, they would share their window bounds. I believe this is a restriction that could lead to strange behaviour (like a window being restored where an unrelated window was last closed) but if you believe this is not a concern I would say this is a reasonable implementation.

In the editor environment, it is reasonable for dialogs of the same class to share bounds to avoid repeated adjustments, and it seems that multiple dialogs of the same class will not appear at the same time (useless?).

As for EditorSettings, I decided to use it this way after seeing that several scripts in scene have introduced editor/... through #ifdef TOOLS_ENABLED. I don’t know the maintainer’s opinion yet. Otherwise PR will be too broad.

图片

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.

Remember size and position of Quick Load window

3 participants