diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/base_button.cpp | 5 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 3 | ||||
-rw-r--r-- | scene/main/viewport.h | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index d7632b14b8..a2b7cd2e0a 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -31,6 +31,7 @@ #include "print_string.h" #include "button_group.h" #include "scene/scene_string_names.h" +#include "scene/main/viewport.h" void BaseButton::_input_event(InputEvent p_event) { @@ -416,6 +417,10 @@ Ref<ShortCut> BaseButton:: get_shortcut() const { void BaseButton::_unhandled_input(InputEvent p_event) { if (!is_disabled() && is_visible() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) { + + if (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)) + return; //ignore because of modal window + if (is_toggle_mode()) { set_pressed(!is_pressed()); emit_signal("toggled",is_pressed()); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f09fac6c71..ff8f0d05f1 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2502,6 +2502,9 @@ Variant Viewport::gui_get_drag_data() const { return gui.drag_data; } +Control *Viewport::get_modal_stack_top() const { + return gui.modal_stack.size()?gui.modal_stack.back()->get():NULL; +} String Viewport::get_configuration_warning() const { diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 545020dfc7..aaa640e0e6 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -374,6 +374,7 @@ public: bool gui_has_modal_stack() const; Variant gui_get_drag_data() const; + Control *get_modal_stack_top() const; virtual String get_configuration_warning() const; |