Skip to content

Commit

Permalink
Allow changing exclusive of already popped up Popup
Browse files Browse the repository at this point in the history
  • Loading branch information
kleonc committed May 27, 2022
1 parent 53843de commit 9ba598f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scene/gui/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,11 @@ void Control::show_modal(bool p_exclusive) {
data.modal_frame = Engine::get_singleton()->get_frames_drawn();
}

void Control::set_modal_exclusive(bool p_exclusive) {
ERR_FAIL_NULL_MSG(data.MI, "Modal exclusive can be set only if the Control is already shown as modal.");
data.modal_exclusive = p_exclusive;
}

void Control::_modal_set_prev_focus_owner(ObjectID p_prev) {
data.modal_prev_focus_owner = p_prev;
}
Expand Down
1 change: 1 addition & 0 deletions scene/gui/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ class Control : public CanvasItem {
virtual void remove_child_notify(Node *p_child);

//virtual void _window_gui_input(InputEvent p_event);
void set_modal_exclusive(bool p_exclusive);

bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
Expand Down
3 changes: 3 additions & 0 deletions scene/gui/popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ void Popup::_popup(const Rect2 &p_bounds, const bool p_centered) {

void Popup::set_exclusive(bool p_exclusive) {
exclusive = p_exclusive;
if (popped_up) {
set_modal_exclusive(exclusive);
}
}

bool Popup::is_exclusive() const {
Expand Down

0 comments on commit 9ba598f

Please sign in to comment.