Don't bind to Alt+Tab

The Alt key is not usable by programs under Windows and Alt+Tab is
reserved on both MSW and Linux.  Instead, we use the Shift modifier to
determine which preset to open
This commit is contained in:
Seth Hillbrand 2022-01-07 15:33:19 -08:00
parent 04c46a8fd2
commit 4a16c603e9
1 changed files with 28 additions and 18 deletions

View File

@ -96,11 +96,15 @@ bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent )
static bool s_presetSwitcherShown = false; static bool s_presetSwitcherShown = false;
static bool s_viewportSwitcherShown = false; static bool s_viewportSwitcherShown = false;
if( !s_presetSwitcherShown && wxGetKeyState( WXK_RAW_CONTROL ) && wxGetKeyState( WXK_TAB ) ) if( !s_presetSwitcherShown && wxGetKeyState( WXK_RAW_CONTROL ) && !wxGetKeyState( WXK_SHIFT )
&& wxGetKeyState( WXK_TAB ) )
{ {
if( m_appearancePanel && this->IsActive() ) if( m_appearancePanel && this->IsActive() )
{ {
const wxArrayString& mru = m_appearancePanel->GetLayerPresetsMRU(); const wxArrayString& mru = m_appearancePanel->GetLayerPresetsMRU();
if( mru.size() > 1 )
{
EDA_VIEW_SWITCHER switcher( this, mru, WXK_RAW_CONTROL ); EDA_VIEW_SWITCHER switcher( this, mru, WXK_RAW_CONTROL );
s_presetSwitcherShown = true; s_presetSwitcherShown = true;
@ -115,12 +119,17 @@ bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent )
return true; return true;
} }
} }
else if( !s_viewportSwitcherShown && wxGetKeyState( WXK_ALT ) && wxGetKeyState( WXK_TAB ) ) }
else if( !s_viewportSwitcherShown && wxGetKeyState( WXK_RAW_CONTROL )
&& wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_TAB ) )
{ {
if( m_appearancePanel && this->IsActive() ) if( m_appearancePanel && this->IsActive() )
{ {
const wxArrayString& mru = m_appearancePanel->GetViewportsMRU(); const wxArrayString& mru = m_appearancePanel->GetViewportsMRU();
EDA_VIEW_SWITCHER switcher( this, mru, WXK_ALT );
if( mru.size() > 1 )
{
EDA_VIEW_SWITCHER switcher( this, mru, WXK_RAW_CONTROL );
s_viewportSwitcherShown = true; s_viewportSwitcherShown = true;
switcher.ShowModal(); switcher.ShowModal();
@ -134,6 +143,7 @@ bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent )
return true; return true;
} }
} }
}
return PCB_BASE_FRAME::TryBefore( aEvent ); return PCB_BASE_FRAME::TryBefore( aEvent );
} }