summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/scene_tree.cpp2
-rw-r--r--scene/main/viewport.cpp21
2 files changed, 17 insertions, 6 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index ce548768bb..bc250ff4d5 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -2351,7 +2351,7 @@ SceneTree::SceneTree() {
ProjectSettings::get_singleton()->set("rendering/environment/default_environment", "");
} else {
//file was erased, notify user.
- ERR_PRINTS(RTR("Default Environment as specified in Project Setings (Rendering -> Environment -> Default Environment) could not be loaded."));
+ ERR_PRINTS(RTR("Default Environment as specified in Project Settings (Rendering -> Environment -> Default Environment) could not be loaded."));
}
}
}
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 6ac99524c8..5f1257a855 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -679,6 +679,20 @@ void Viewport::_notification(int p_what) {
}
} break;
+ case SceneTree::NOTIFICATION_WM_FOCUS_OUT: {
+ if (gui.mouse_focus) {
+ //if mouse is being pressed, send a release event
+ Ref<InputEventMouseButton> mb;
+ mb.instance();
+ mb->set_position(gui.mouse_focus->get_local_mouse_position());
+ mb->set_global_position(gui.mouse_focus->get_local_mouse_position());
+ mb->set_button_index(gui.mouse_focus_button);
+ mb->set_pressed(false);
+ Control *c = gui.mouse_focus;
+ gui.mouse_focus = NULL;
+ c->call_multilevel(SceneStringNames::get_singleton()->_gui_input, mb);
+ }
+ } break;
}
}
@@ -2377,12 +2391,9 @@ List<Control *>::Element *Viewport::_gui_show_modal(Control *p_control) {
mb->set_global_position(gui.mouse_focus->get_local_mouse_position());
mb->set_button_index(gui.mouse_focus_button);
mb->set_pressed(false);
- gui.mouse_focus->call_multilevel(SceneStringNames::get_singleton()->_gui_input, mb);
-
- //if (gui.mouse_over == gui.mouse_focus) {
- // gui.mouse_focus->notification(Control::NOTIFICATION_MOUSE_EXIT);
- //}
+ Control *c = gui.mouse_focus;
gui.mouse_focus = NULL;
+ c->call_multilevel(SceneStringNames::get_singleton()->_gui_input, mb);
}
return gui.modal_stack.back();