Hard code text control margins for GTK 2

Using GTKGetPreferredSize() doesn't always seem to return the correct
values, resulting in making the control too big, so just hard code the
smaller margins there.
This commit is contained in:
Vadim Zeitlin 2023-02-04 13:58:02 +01:00
parent 489e4c869e
commit 4f6ddcf511

View file

@ -2150,8 +2150,16 @@ wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const
{
// default height
tsize.y = GTKGetPreferredSize(m_widget).y;
#ifdef __WXGTK3__
// Add the margins we have previously set.
tsize.IncBy( GTKGetEntryMargins(GetEntry()) );
#else
// For GTK 2 these margins are too big, so hard code something more
// reasonable, this is not great but should be fine considering
// that it's very unlikely that GTK 2 is going to evolve, making
// this inappropriate.
tsize.IncBy(20, 0);
#endif
}
}