Use vertical GTK entry margins too in DoGetSizeFromTextSize()

This actually makes the height returned from it smaller, as these
margins are negative (at least with GTK 3), but this works well with the
size returned by GTKGetPreferredSize() which would be too big otherwise,
as it seems to include the margins around the control too.
This commit is contained in:
Vadim Zeitlin 2023-02-02 17:10:04 +01:00
parent 44e9218e03
commit 3e01634976

View file

@ -2150,10 +2150,8 @@ wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const
{
// default height
tsize.y = GTKGetPreferredSize(m_widget).y;
// Add the margins we have previously set, but only the horizontal border
// as vertical one has been taken account at GTKGetPreferredSize().
// Also get other GTK+ margins.
tsize.IncBy( GTKGetEntryMargins(GetEntry()).x, 0);
// Add the margins we have previously set.
tsize.IncBy( GTKGetEntryMargins(GetEntry()) );
}
}