-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Fix progress dialog steals focus #99844
Conversation
I sometimes see window focus issues when opening a project, is it possible to carry this over to importing a project? |
Yes, it's already included. |
36bc47c
to
3759100
Compare
839ea69
to
8d2778c
Compare
I'm using this PR for the last couple of days and it works great so far. It's very nice to be able to import assets in the background without Godot stealing the focus. The only issue so far is the "Export Project..." button in the Export window. I need to do it twice for the exportation to run. Also, if I press only one time, select the file and close the window, the next time the Export window is opened, the exportation is executed. |
8d2778c
to
215984c
Compare
Should be fixed now, although I had to modify EditorFileDialog to emit |
I'm really worry about this modification, that means that the editor file dialog will still be opened when saving a scene or when opening almost anything in the editor. Just to be sure, I reverted locally the modifications in |
The file dialog did not return focus to export dialog and so the progress was appearing above the hidden file dialog, instead of the export dialog. Tested on Windows. |
215984c
to
6fe259b
Compare
Ok I reverted the EditorExport/FileDialog changes. The issue I had before doesn't seem to be happening anymore. |
void EditorNode::input(const Ref<InputEvent> &p_event) { | ||
// EditorNode::get_singleton()->set_process_input is set to true in ProgressDialog | ||
// only when the progress dialog is visible. | ||
// We need to discard all key events to disable all shortcuts while the progress | ||
// dialog is displayed, simulating an exclusive popup. Mouse events are | ||
// captured by a full-screen container in front of the EditorNode in ProgressDialog, | ||
// allowing interaction with the actual dialog where a Cancel button may be visible. | ||
Ref<InputEventKey> k = p_event; | ||
if (k.is_valid()) { | ||
get_tree()->get_root()->set_input_as_handled(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work if you're trying to press the Cancel button of ProgressDialog with key events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you can't.
However canceling was broken before (at least during export: #93481) and now you can cancel with mouse, so it's still an improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's working when the ProgressDialog is not in another popup because the progress dialog is parented to the root
and not the EditorNode
. I guess a possible fix could be to accept space
and enter
key in EditorNode::input
. The set_input_as_handled
is really only used for shortcuts.
I detected another wierd side effect. When a sub scene is used in a main scene and both scenes are opened, when switching back to the main scene, the progress "Updating scene" appears and after that the first right click displays and context menu of the scene tab. My guess is that godot.windows.editor.x86_64_wcKb0h8kXG.mp4 |
No idea what causes it. Hiding the dialog and removing all input/processing overrides does not fix the issue. It's like it's caused by the existence of the dialog alone. |
The issue is caused because |
It's part of the code that manually processes SceneTree. It's probably supposed to keep the dialog responsive and allow to cancel during processing. I'll just remove this line. |
6fe259b
to
d0fe15e
Compare
Nice, it fixes the issue. I'll continue working in Godot using this PR to see if I spot other side effects. |
Ok, I found a workaround... The issue is that So adding these lines in ...
reparent(current_window);
bool window_is_input_disabled = current_window->is_input_disabled();
current_window->set_disable_input(!window_is_input_disabled);
current_window->set_disable_input(window_is_input_disabled);
show(); Note that there's probably a more elegant way to fix the issue but it works. |
Co-authored-by: Hilderin <81109165+Hilderin@users.noreply.github.com>
d0fe15e
to
77d18d1
Compare
Thanks! |
Same as #97009, but I made the dialog appear on currently focused window.
Fixes #96994
Fixes #90944