From cda3a82c668ca66b7d22ebc4b4a7040b90456509 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 24 Jun 2019 13:35:25 +0100 Subject: [PATCH] Implement our own navigation out of a grid. While wxWidgets has Navigate() and NavigateIn(), they're not compiled on GTK because it supposedly has native TAB control. Of course its native TAB control won't get you out of a grid, so that leaves us in a bit of a pinch. This implements a poor-man's Navigate() which will at least get us out of the grid. Fixes: lp:1810569 * https://bugs.launchpad.net/kicad/+bug/1810569 --- common/grid_tricks.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/common/grid_tricks.cpp b/common/grid_tricks.cpp index 8d879229d2..635f88870d 100644 --- a/common/grid_tricks.cpp +++ b/common/grid_tricks.cpp @@ -347,6 +347,53 @@ void GRID_TRICKS::onKeyDown( wxKeyEvent& ev ) return; } + // ctrl-tab for exit grid +#ifdef __APPLE__ + bool ctrl = ev.RawControlDown(); +#else + bool ctrl = ev.ControlDown(); +#endif + + if( ctrl && ev.GetKeyCode() == WXK_TAB ) + { + wxWindow* test = m_grid->GetNextSibling(); + + if( !test ) + test = m_grid->GetParent()->GetNextSibling(); + + while( test && !test->IsTopLevel() ) + { + test->SetFocus(); + + if( test->HasFocus() ) + break; + + if( !test->GetChildren().empty() ) + test = test->GetChildren().front(); + else if( test->GetNextSibling() ) + test = test->GetNextSibling(); + else + { + while( test ) + { + test = test->GetParent(); + + if( test && test->IsTopLevel() ) + { + break; + } + else if( test && test->GetNextSibling() ) + { + test = test->GetNextSibling(); + break; + } + } + } + } + + return; + } + ev.Skip( true ); }