From 10684e9961c7ddbba9f6d260a63cc33eaa2ba927 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 20 Apr 2020 21:49:00 +0100 Subject: [PATCH] Attempt to work around clipping bug on GTK wxSearchCtrl. --- common/dialogs/panel_hotkeys_editor.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/common/dialogs/panel_hotkeys_editor.cpp b/common/dialogs/panel_hotkeys_editor.cpp index 1d1d2e1cd1..69d4de8f1c 100644 --- a/common/dialogs/panel_hotkeys_editor.cpp +++ b/common/dialogs/panel_hotkeys_editor.cpp @@ -45,7 +45,7 @@ static const wxSize default_dialog_size { 500, 350 }; */ static wxSearchCtrl* CreateTextFilterBox( wxWindow* aParent, const wxString& aDescriptiveText ) { - auto search_widget = new wxSearchCtrl( aParent, wxID_ANY ); + wxSearchCtrl* search_widget = new wxSearchCtrl( aParent, wxID_ANY ); search_widget->ShowSearchButton( false ); search_widget->ShowCancelButton( true ); @@ -64,12 +64,12 @@ PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aW m_hotkeyStore() { const auto margin = KIUI::GetStdMargin(); - auto mainSizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL ); const int side_margins = margin * 2; - auto bMargins = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bMargins = new wxBoxSizer( wxVERTICAL ); - auto filterSearch = CreateTextFilterBox( this, _( "Type filter text" ) ); + wxSearchCtrl* filterSearch = CreateTextFilterBox( this, _( "Type filter text" ) ); bMargins->Add( filterSearch, 0, wxBOTTOM | wxEXPAND | wxTOP, margin ); m_hotkeyListCtrl = new WIDGET_HOTKEY_LIST( this, m_hotkeyStore, m_readOnly ); @@ -83,6 +83,14 @@ PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aW this->SetSizer( mainSizer ); this->Layout(); +#ifdef __WXGTK__ + // Work around a bug that clips the text vertically in the wxSearchCtrl on GTK + filterSearch->SetMinSize( wxSize( filterSearch->GetSize().x, + filterSearch->GetSize().y + 4 ) ); + + this->Layout(); +#endif + // Connect Events filterSearch->Bind( wxEVT_COMMAND_TEXT_UPDATED, &PANEL_HOTKEYS_EDITOR::OnFilterSearch, this ); }