From 1e7b9c509f02dd641f10fe50d24bb19c165078d7 Mon Sep 17 00:00:00 2001 From: Jaroslaw Filiochowski Date: Mon, 18 Jul 2016 22:14:57 +0200 Subject: Don't start a new tooltip timer for the same tooltip --- scene/main/viewport.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scene/main/viewport.cpp') diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index bb6e6e289b..9d2b0cfccf 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2007,8 +2007,16 @@ void Viewport::_gui_input_event(InputEvent p_event) { } + bool is_tooltip_shown = false; - if (can_tooltip) { + if (can_tooltip && gui.tooltip_popup) { + String tooltip = over->get_tooltip(gui.tooltip->get_global_transform().xform_inv(mpos)); + + if (gui.tooltip_popup && tooltip == gui.tooltip_label->get_text()) + is_tooltip_shown = true; + } + + if (can_tooltip && !is_tooltip_shown) { gui.tooltip=over; gui.tooltip_pos=mpos;//(parent_xform * get_transform()).affine_inverse().xform(pos); -- cgit v1.2.3 From be560a750c363355ad077331bf6bdbc62c6b2762 Mon Sep 17 00:00:00 2001 From: Jaroslaw Filiochowski Date: Tue, 19 Jul 2016 06:27:12 +0200 Subject: Hide tooltip if new mouse position's tooltip is empty --- scene/main/viewport.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'scene/main/viewport.cpp') diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 9d2b0cfccf..cf84f8f425 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2009,11 +2009,17 @@ void Viewport::_gui_input_event(InputEvent p_event) { bool is_tooltip_shown = false; - if (can_tooltip && gui.tooltip_popup) { - String tooltip = over->get_tooltip(gui.tooltip->get_global_transform().xform_inv(mpos)); - - if (gui.tooltip_popup && tooltip == gui.tooltip_label->get_text()) - is_tooltip_shown = true; + if (gui.tooltip_popup) { + if (can_tooltip) { + String tooltip = over->get_tooltip(gui.tooltip->get_global_transform().xform_inv(mpos)); + + if (tooltip.length() == 0) + _gui_cancel_tooltip(); + else if (tooltip == gui.tooltip_label->get_text()) + is_tooltip_shown = true; + } + else + _gui_cancel_tooltip(); } if (can_tooltip && !is_tooltip_shown) { -- cgit v1.2.3 From 67640c84eb60238be7e75d1b0d9d937518f885fb Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Sat, 23 Jul 2016 21:25:00 +0200 Subject: Viewport: Replace obsolete "windows" group calls - Fixes neighbour focusing event propagation not being stopped --- scene/main/viewport.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'scene/main/viewport.cpp') diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index bdb2754e5e..8faee0c549 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1782,7 +1782,6 @@ void Viewport::_gui_input_event(InputEvent p_event) { if (top->data.modal_exclusive || top->data.modal_frame==OS::get_singleton()->get_frames_drawn()) { //cancel event, sorry, modal exclusive EATS UP ALL //alternative, you can't pop out a window the same frame it was made modal (fixes many issues) - //get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); get_tree()->set_input_as_handled(); return; // no one gets the event if exclusive NO ONE } @@ -2062,7 +2061,6 @@ void Viewport::_gui_input_event(InputEvent p_event) { - //get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); get_tree()->set_input_as_handled(); @@ -2102,7 +2100,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { if (gui.key_event_accepted) { - get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->set_input_as_handled(); break; } } @@ -2162,7 +2160,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { if (next) { next->grab_focus(); - get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->set_input_as_handled(); } } @@ -2355,8 +2353,7 @@ void Viewport::_gui_control_grab_focus(Control* p_control) { if (gui.key_focus && gui.key_focus==p_control) return; - _gui_remove_focus(); - get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_gui_remove_focus"); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"_viewports","_gui_remove_focus"); gui.key_focus=p_control; p_control->notification(Control::NOTIFICATION_FOCUS_ENTER); p_control->update(); @@ -2664,6 +2661,7 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_input_disabled"), &Viewport::is_input_disabled); ObjectTypeDB::bind_method(_MD("_gui_show_tooltip"), &Viewport::_gui_show_tooltip); + ObjectTypeDB::bind_method(_MD("_gui_remove_focus"), &Viewport::_gui_remove_focus); ADD_PROPERTY( PropertyInfo(Variant::RECT2,"rect"), _SCS("set_rect"), _SCS("get_rect") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"own_world"), _SCS("set_use_own_world"), _SCS("is_using_own_world") ); -- cgit v1.2.3 From 4755fe5576b05c94081bdcad5bd37523d5040150 Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Sat, 30 Jul 2016 12:38:42 +0200 Subject: UI navigation via JOYSTICK_MOTION. Previously, you could assign joystick axis events to "ui_*" actions but they had no effect. See https://godotengine.org/qa/6232 --- scene/main/viewport.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'scene/main/viewport.cpp') diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f182f2c96c..7970229c06 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2095,6 +2095,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { } break; case InputEvent::ACTION: case InputEvent::JOYSTICK_BUTTON: + case InputEvent::JOYSTICK_MOTION: case InputEvent::KEY: { -- cgit v1.2.3