diff options
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 3 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 1 | ||||
-rw-r--r-- | scene/gui/control.cpp | 5 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 21 |
4 files changed, 21 insertions, 9 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index af5f4653a0..2ccc661343 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -445,8 +445,7 @@ VERTEX_SHADER_CODE vtx.z=(distance/shadow_dual_paraboloid_render_zfar); vtx.z=vtx.z * 2.0 - 1.0; - vertex.xyz=vtx; - vertex.w=1.0; + vertex_interp = vtx; #else diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 22294005f6..4f4b225b14 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -416,6 +416,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /*mm->get_button_mask()|=(wParam&MK_XBUTTON1)?(1<<5):0; mm->get_button_mask()|=(wParam&MK_XBUTTON2)?(1<<6):0;*/ mm->set_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); + mm->set_global_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); if (mouse_mode == MOUSE_MODE_CAPTURED) { 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/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(); |