Merge pull request #79293 from ItsNL/add-accept-dialog-close-on-unfocused

Check `FLAG_POPUP` to close an AcceptDialog when parent is focused
This commit is contained in:
Rémi Verschelde
2023-08-02 12:17:06 +02:00
2 changed files with 1 additions and 2 deletions

View File

@@ -626,7 +626,6 @@
</member>
<member name="popup_window" type="bool" setter="set_flag" getter="get_flag" default="false">
If [code]true[/code], the [Window] will be considered a popup. Popups are sub-windows that don't show as separate windows in system's window manager's window list and will send close request when anything is clicked outside of them (unless [member exclusive] is enabled).
[b]Note:[/b] This property only works with native windows.
</member>
<member name="position" type="Vector2i" setter="set_position" getter="get_position" default="Vector2i(0, 0)">
The window's position in pixels.

View File

@@ -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() && get_flag(FLAG_POPUP)) {
_cancel_pressed();
}
}