summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-21 19:00:25 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-21 19:01:00 -0300
commit0aa7242624fcd74eaf13db006274829c284fab3b (patch)
tree85ae8bc9d725f191da68f1b9ffe1e426025e8fb2 /scene/main
parentc4d6e54e93431e94888c5594386bcd0aa22528ee (diff)
WIP new AudioServer, with buses, effects, etc.
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/viewport.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 14acf9583d..63c86c8e9d 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1901,9 +1901,28 @@ void Viewport::_gui_input_event(InputEvent p_event) {
}*/
#endif
- if (gui.mouse_focus->get_focus_mode()!=Control::FOCUS_NONE && gui.mouse_focus!=gui.key_focus && p_event.mouse_button.button_index==BUTTON_LEFT) {
- // also get keyboard focus
- gui.mouse_focus->grab_focus();
+ if (p_event.mouse_button.button_index==BUTTON_LEFT) { //assign focus
+ CanvasItem *ci=gui.mouse_focus;
+ while(ci) {
+
+ Control *control = ci->cast_to<Control>();
+ if (control) {
+ if (control->get_focus_mode()!=Control::FOCUS_NONE) {
+ if (control!=gui.key_focus) {
+ control->grab_focus();
+ }
+ break;
+ }
+
+ if (control->data.mouse_filter==Control::MOUSE_FILTER_STOP)
+ break;
+ }
+
+ if (ci->is_set_as_toplevel())
+ break;
+
+ ci=ci->get_parent_item();
+ }
}