From b5dacc659d1bbf206f3c3406dc8555896234b792 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 29 Sep 2023 23:13:59 +0100 Subject: [PATCH] Don't hide preview when mouse is in the preview window. --- common/widgets/lib_tree.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/widgets/lib_tree.cpp b/common/widgets/lib_tree.cpp index 3a70f6d8e3..8b50ede35f 100644 --- a/common/widgets/lib_tree.cpp +++ b/common/widgets/lib_tree.cpp @@ -650,12 +650,16 @@ void LIB_TREE::onIdle( wxIdleEvent& aEvent ) wxWindow* topLevelParent = wxGetTopLevelParent( m_parent ); wxWindow* topLevelFocus = wxGetTopLevelParent( wxWindow::FindFocus() ); + bool mouseOverWindow = false; wxPoint screenPos = wxGetMousePosition(); - wxRect screenRect = m_tree_ctrl->GetScreenRect(); - if( !m_tree_ctrl->IsShown() || m_previewDisabled - || topLevelFocus != topLevelParent - || !screenRect.Contains( screenPos ) ) + if( m_tree_ctrl && m_tree_ctrl->IsShown() ) + mouseOverWindow |= m_tree_ctrl->GetScreenRect().Contains( screenPos ); + + if( m_previewWindow && m_previewWindow->IsShown() ) + mouseOverWindow |= m_previewWindow->GetScreenRect().Contains( screenPos ); + + if( m_previewDisabled || topLevelFocus != topLevelParent || !mouseOverWindow ) { m_hoverTimer.Stop(); hidePreview();