summaryrefslogtreecommitdiff
path: root/scene/gui/menu_button.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2016-07-18 23:06:14 +0200
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2016-07-18 23:06:14 +0200
commitc45837cf3f39eaaf70b6662a036e1c76bba6c6ee (patch)
treef3b59e50d4af8a9ce0d89df3759d1f004150df7f /scene/gui/menu_button.cpp
parent6a5e11c075b6bc48d23267c03a66e613dee2bf55 (diff)
MenuButton: Fix event propagation with dialogs
Diffstat (limited to 'scene/gui/menu_button.cpp')
-rw-r--r--scene/gui/menu_button.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index d6e084765d..725f1ddf17 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -28,6 +28,7 @@
/*************************************************************************/
#include "menu_button.h"
#include "os/keyboard.h"
+#include "scene/main/viewport.h"
void MenuButton::_unhandled_key_input(InputEvent p_event) {
@@ -38,6 +39,9 @@ void MenuButton::_unhandled_key_input(InputEvent p_event) {
if (!get_parent() || !is_visible() || is_disabled())
return;
+ 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 (popup->activate_item_by_event(p_event))
accept_event();