diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/base_button.cpp | 6 | ||||
-rw-r--r-- | scene/gui/control.cpp | 5 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 2 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 21 |
4 files changed, 23 insertions, 11 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 0f1681a24e..d765248cca 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -539,15 +539,15 @@ BaseButton::BaseButton() { set_focus_mode(FOCUS_ALL); enabled_focus_mode = FOCUS_ALL; action_mode = ACTION_MODE_BUTTON_RELEASE; +} + +BaseButton::~BaseButton() { if (button_group.is_valid()) { button_group->buttons.erase(this); } } -BaseButton::~BaseButton() { -} - void ButtonGroup::get_buttons(List<BaseButton *> *r_buttons) { for (Set<BaseButton *>::Element *E = buttons.front(); E; E = E->next()) { diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 6419659741..979a65f455 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -861,6 +861,8 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName & class_name = ClassDB::get_parent_class_nocheck(class_name); } + class_name = type; + Control *parent = Object::cast_to<Control>(theme_owner->get_parent()); if (parent) @@ -869,8 +871,6 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName & theme_owner = NULL; } - class_name = type; - while (class_name != StringName()) { if (Theme::get_default()->has_stylebox(p_name, class_name)) return Theme::get_default()->get_stylebox(p_name, class_name); @@ -2155,6 +2155,7 @@ void Control::set_theme(const Ref<Theme> &p_theme) { data.theme = p_theme; if (!p_theme.is_null()) { + data.theme_owner = this; _propagate_theme_changed(this, this); } else { 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(); |