summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-07-01 10:42:33 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-07-01 10:42:33 -0300
commit3185ce64c5c27c3ce7c4ce755bfc890bac172f04 (patch)
tree183ad2a3cf514d966f8b82de5fe1cc4268765328 /scene
parentdb9335f4c1247d950b4858b56d653975bb3058ff (diff)
Invalidate key focus if not visible, fixes #5354
Diffstat (limited to 'scene')
-rw-r--r--scene/main/viewport.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index ef00dcec49..8df7bb4791 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2058,7 +2058,12 @@ void Viewport::_gui_input_event(InputEvent p_event) {
case InputEvent::JOYSTICK_BUTTON:
case InputEvent::KEY: {
- if (gui.key_focus) {
+ if (gui.key_focus && !gui.key_focus->is_visible()) {
+ //key focus must always be visible
+ gui.key_focus->release_focus();
+ }
+
+ if (gui.key_focus) {
gui.key_event_accepted=false;
if (gui.key_focus->can_process()) {