From 3e0163497614741de83ac64c6aa04c024a0447f5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 2 Feb 2023 17:10:04 +0100 Subject: [PATCH] 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. --- src/gtk/textctrl.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index db21759851..861645ae8f 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -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()) ); } }