Don't call EndModal before ShowModal.
It'll get shown, but can then never be closed. Fixes https://gitlab.com/kicad/code/kicad/issues/5346
This commit is contained in:
parent
dcf058d91e
commit
29a459768a
|
@ -37,7 +37,7 @@
|
||||||
EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aItems ) :
|
EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aItems ) :
|
||||||
EDA_VIEW_SWITCHER_BASE( aParent ),
|
EDA_VIEW_SWITCHER_BASE( aParent ),
|
||||||
m_tabState( true ),
|
m_tabState( true ),
|
||||||
m_receivingEvents( true )
|
m_receivingEvents( false )
|
||||||
{
|
{
|
||||||
m_listBox->InsertItems( aItems, 0 );
|
m_listBox->InsertItems( aItems, 0 );
|
||||||
m_listBox->SetSelection( std::min( 1, (int) m_listBox->GetCount() - 1 ) );
|
m_listBox->SetSelection( std::min( 1, (int) m_listBox->GetCount() - 1 ) );
|
||||||
|
@ -63,6 +63,20 @@ EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool EDA_VIEW_SWITCHER::Show( bool aShow )
|
||||||
|
{
|
||||||
|
if( !aShow )
|
||||||
|
m_receivingEvents = false;
|
||||||
|
|
||||||
|
bool ret = DIALOG_SHIM::Show( aShow );
|
||||||
|
|
||||||
|
if( aShow )
|
||||||
|
m_receivingEvents = true;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// OK, this is *really* annoying, but wxWidgets doesn't give us key-down events while the
|
// OK, this is *really* annoying, but wxWidgets doesn't give us key-down events while the
|
||||||
// control key is being held down. So we can't use OnKeyDown() or OnCharHook() and instead
|
// control key is being held down. So we can't use OnKeyDown() or OnCharHook() and instead
|
||||||
// must rely on watching key states in TryBefore().
|
// must rely on watching key states in TryBefore().
|
||||||
|
@ -79,13 +93,6 @@ bool EDA_VIEW_SWITCHER::TryBefore( wxEvent& aEvent )
|
||||||
return DIALOG_SHIM::TryBefore( aEvent );
|
return DIALOG_SHIM::TryBefore( aEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !wxGetKeyState( WXK_RAW_CONTROL ) )
|
|
||||||
{
|
|
||||||
m_receivingEvents = false;
|
|
||||||
EndModal( wxID_OK );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for tab key leading edge
|
// Check for tab key leading edge
|
||||||
if( !m_tabState && wxGetKeyState( WXK_TAB ) )
|
if( !m_tabState && wxGetKeyState( WXK_TAB ) )
|
||||||
{
|
{
|
||||||
|
@ -117,5 +124,11 @@ bool EDA_VIEW_SWITCHER::TryBefore( wxEvent& aEvent )
|
||||||
m_tabState = false;
|
m_tabState = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for control key trailing edge
|
||||||
|
if( !wxGetKeyState( WXK_RAW_CONTROL ) )
|
||||||
|
{
|
||||||
|
EndModal( wxID_OK );
|
||||||
|
}
|
||||||
|
|
||||||
return DIALOG_SHIM::TryBefore( aEvent );
|
return DIALOG_SHIM::TryBefore( aEvent );
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool TryBefore( wxEvent& aEvent ) override;
|
bool TryBefore( wxEvent& aEvent ) override;
|
||||||
|
bool Show( bool show ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_tabState;
|
bool m_tabState;
|
||||||
|
|
Loading…
Reference in New Issue