-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Check FLAG_POPUP
to close an AcceptDialog when parent is focused
#79293
Check FLAG_POPUP
to close an AcceptDialog when parent is focused
#79293
Conversation
I was rather thinking along the lines of diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 0860bf3968..5865e06ec9 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -45,7 +45,7 @@ void AcceptDialog::_input_from_window(const Ref<InputEvent> &p_event) {
}
void AcceptDialog::_parent_focused() {
- if (close_on_escape && !is_exclusive()) {
+ if (!is_exclusive()) {
_cancel_pressed();
}
} I am not sure, if there is a use-case supporting |
Your option uses |
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 won't work with native windows when switching focus to the other app, so the property name can be misleading. For native windows, the same behavior is handled by FLAG_POPUP, so it probably should check it instead of adding a new property.
I have the changes ready using FLAG_POPUP and it works fine. Should I create another Pull Request and close this one? Because now it has nothing to do with this Pull Request. |
You can change commit message and title. No need to make new PR. |
17bc182
to
267e4bf
Compare
With the new way of using
I don't think I have to change it because the behavior described doesn't involve the change. |
I can confirm, that this solves the linked issue for me. After a few tests, I believe, that the note can be removed:
The description fits with the behavior of non-native windows. |
267e4bf
to
a77d8b3
Compare
Ok. I've deleted the note now. |
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.
Have tested it successfully with my MRP in the linked issue.
FLAG_POPUP
to close an AcceptDialog when parent is focused
Thanks! |
Fix #79150
The
close_on_escape
property was used to be able to close an AcceptDialog by pressing theEsc
key, but it was also checked to close when the parent was focused, meaning it had lost the focus.With this pull request instead of checking if
close_on_escape
istrue
to close automatically when the parent is focused (For example clicking outside of the dialog), it will check ifpopup_window
istrue
.Now
dialogue_close_on_escape
only affects if pressing theEsc
key will close the dialog.Here is a video showing the change:
close_on_unfocused.test.-.fix.79150.-.godot.mp4
Note: When using
popup_window
you will need thatexclusive
isfalse
so that it works.exclusive
astrue
blocks all input that is outside the dialog.Note 2: When only using
dialog_close_on_escape
clicking outside will make the dialog's focus be lost and so usingEsc
won't work until the dialog has the focus again.