summaryrefslogtreecommitdiffstats
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2024-07-05 12:23:13 +0300
committerDanil Alexeev <danil@alexeev.xyz>2024-07-05 16:08:35 +0300
commitec2f9355f5c97cf2a6577f7b8b665e35fba7bb7a (patch)
tree56b4d36b4ff015ec4c6979d2f83d530c7635d172 /editor/editor_help.cpp
parent20ba2f00bd9199b675176a8e1ac151f96bfb5cfa (diff)
downloadredot-engine-ec2f9355f5c97cf2a6577f7b8b665e35fba7bb7a.tar.gz
Editor: Fix `EditorHelpBitTooltip` for Signals dock
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r--editor/editor_help.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 00ac1c7c6f..5725129f65 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -3761,6 +3761,12 @@ EditorHelpBit::EditorHelpBit(const String &p_symbol) {
/// EditorHelpBitTooltip ///
+void EditorHelpBitTooltip::_start_timer() {
+ if (timer->is_inside_tree() && timer->is_stopped()) {
+ timer->start();
+ }
+}
+
void EditorHelpBitTooltip::_safe_queue_free() {
if (_pushing_input > 0) {
_need_free = true;
@@ -3769,13 +3775,20 @@ void EditorHelpBitTooltip::_safe_queue_free() {
}
}
+void EditorHelpBitTooltip::_target_gui_input(const Ref<InputEvent> &p_event) {
+ const Ref<InputEventMouse> mouse_event = p_event;
+ if (mouse_event.is_valid()) {
+ _start_timer();
+ }
+}
+
void EditorHelpBitTooltip::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_WM_MOUSE_ENTER:
timer->stop();
break;
case NOTIFICATION_WM_MOUSE_EXIT:
- timer->start();
+ _start_timer();
break;
}
}
@@ -3783,7 +3796,7 @@ void EditorHelpBitTooltip::_notification(int p_what) {
// Forwards non-mouse input to the parent viewport.
void EditorHelpBitTooltip::_input_from_window(const Ref<InputEvent> &p_event) {
if (p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) {
- hide(); // Will be deleted on its timer.
+ _safe_queue_free();
} else {
const Ref<InputEventMouse> mouse_event = p_event;
if (mouse_event.is_null()) {
@@ -3801,7 +3814,7 @@ void EditorHelpBitTooltip::_input_from_window(const Ref<InputEvent> &p_event) {
void EditorHelpBitTooltip::show_tooltip(EditorHelpBit *p_help_bit, Control *p_target) {
ERR_FAIL_NULL(p_help_bit);
EditorHelpBitTooltip *tooltip = memnew(EditorHelpBitTooltip(p_target));
- p_help_bit->connect("request_hide", callable_mp(static_cast<Window *>(tooltip), &Window::hide)); // Will be deleted on its timer.
+ p_help_bit->connect("request_hide", callable_mp(tooltip, &EditorHelpBitTooltip::_safe_queue_free));
tooltip->add_child(p_help_bit);
p_target->get_viewport()->add_child(tooltip);
p_help_bit->update_content_height();
@@ -3858,8 +3871,8 @@ EditorHelpBitTooltip::EditorHelpBitTooltip(Control *p_target) {
add_child(timer);
ERR_FAIL_NULL(p_target);
- p_target->connect(SceneStringName(mouse_entered), callable_mp(timer, &Timer::stop));
- p_target->connect(SceneStringName(mouse_exited), callable_mp(timer, &Timer::start).bind(-1));
+ p_target->connect(SceneStringName(mouse_exited), callable_mp(this, &EditorHelpBitTooltip::_start_timer));
+ p_target->connect(SceneStringName(gui_input), callable_mp(this, &EditorHelpBitTooltip::_target_gui_input));
}
#if defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)