From 3cc6e0cf020f327a552576de9dcf016c12c48abf Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 25 Sep 2018 17:53:04 +0100 Subject: [PATCH] Fixes to NET_SELECTOR event loop for non-OSX platforms. Don't assume events are always Pending(). Other platforms handle idle events differently. --- common/widgets/net_selector.cpp | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/common/widgets/net_selector.cpp b/common/widgets/net_selector.cpp index 3dd7bcf5a9..0251a26e81 100644 --- a/common/widgets/net_selector.cpp +++ b/common/widgets/net_selector.cpp @@ -96,43 +96,43 @@ public: wxGUIEventLoop eventLoop; wxEventLoopActivator activate( &eventLoop ); - while ( eventLoop.Pending() ) + while( !m_cancelled && !m_selected ) { - wxPoint screenPos = wxGetMousePosition(); - - if( m_netListBox->GetScreenRect().Contains( screenPos ) ) + if( eventLoop.Pending() ) { - if( HasCapture() ) - ReleaseMouse(); + wxPoint screenPos = wxGetMousePosition(); + + if( m_netListBox->GetScreenRect().Contains( screenPos ) ) + { + if( HasCapture() ) + ReleaseMouse(); #ifdef __WXOSX_MAC__ - m_netListBox->OSXForceFocus(); + m_netListBox->OSXForceFocus(); #else - m_netListBox->SetFocus(); + m_netListBox->SetFocus(); #endif - wxPoint relativePos = m_netListBox->ScreenToClient( screenPos ); - int item = m_netListBox->HitTest( relativePos ); + wxPoint relativePos = m_netListBox->ScreenToClient( screenPos ); + int item = m_netListBox->HitTest( relativePos ); - if( item >= 0 ) - m_netListBox->SetSelection( item ); + if( item >= 0 ) + m_netListBox->SetSelection( item ); + } + else if( m_filterCtrl->GetScreenRect().Contains( screenPos ) ) + { + if( HasCapture() ) + ReleaseMouse(); + + m_filterCtrl->SetFocus(); + } + else if( !HasCapture() ) + { + CaptureMouse(); + } + + eventLoop.Dispatch(); } - else if( m_filterCtrl->GetScreenRect().Contains( screenPos ) ) - { - if( HasCapture() ) - ReleaseMouse(); - - m_filterCtrl->SetFocus(); - } - else if( !HasCapture() ) - { - CaptureMouse(); - } - - eventLoop.Dispatch(); - - if( m_cancelled || m_selected ) - break; wxSafeYield( m_parent ); }