From 79951630ec08da7f1db248f08427f2b4fad7c45c Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 18 Mar 2020 14:28:43 +0100 Subject: [PATCH] Hiding the tooltip when the window gets deactivated and reactivated. --- src/slic3r/GUI/GLCanvas3D.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 16cce24ed..a86fa8c15 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2003,22 +2003,27 @@ void GLCanvas3D::render() #endif // ENABLE_CAMERA_STATISTICS #if ENABLE_CANVAS_TOOLTIP_USING_IMGUI - std::string tooltip = ""; + std::string tooltip; - if (tooltip.empty()) - tooltip = m_layers_editing.get_tooltip(*this); + // Negative coordinate means out of the window, likely because the window was deactivated. + // In that case the tooltip should be hidden. + if (m_mouse.position.x() >= 0. && m_mouse.position.y() >= 0.) + { + if (tooltip.empty()) + tooltip = m_layers_editing.get_tooltip(*this); - if (tooltip.empty()) - tooltip = m_gizmos.get_tooltip(); + if (tooltip.empty()) + tooltip = m_gizmos.get_tooltip(); - if (tooltip.empty()) - tooltip = m_main_toolbar.get_tooltip(); + if (tooltip.empty()) + tooltip = m_main_toolbar.get_tooltip(); - if (tooltip.empty()) - tooltip = m_undoredo_toolbar.get_tooltip(); + if (tooltip.empty()) + tooltip = m_undoredo_toolbar.get_tooltip(); - if (tooltip.empty()) - tooltip = m_view_toolbar.get_tooltip(); + if (tooltip.empty()) + tooltip = m_view_toolbar.get_tooltip(); + } set_tooltip(tooltip);