Don't hide preview when mouse is in the preview window.

This commit is contained in:
Jeff Young 2023-09-29 23:13:59 +01:00
parent e1c51ed192
commit b5dacc659d
1 changed files with 8 additions and 4 deletions

View File

@ -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();