From 26826c9beab45b1092ae701da8c956a796433bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sun, 21 Feb 2021 09:58:27 +0100 Subject: [PATCH] Fix wxOSX sizing of borderless wxBitmapButton Don't apply the workaround required for NSRoundedBezelStyle and NSTexturedRoundedBezelStyle, i.e. enlarging too small buttons, if these bezel styles are not used. In particular, avoid enlarging buttons with wxBORDER_NONE or wxBORDER_SIMPLE. Follow-up to 0941b25. --- src/osx/bmpbuttn_osx.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/osx/bmpbuttn_osx.cpp b/src/osx/bmpbuttn_osx.cpp index 1dea31518f..ada2af4f89 100644 --- a/src/osx/bmpbuttn_osx.cpp +++ b/src/osx/bmpbuttn_osx.cpp @@ -66,9 +66,18 @@ wxSize wxBitmapButton::DoGetBestSize() const // account for it here to prevent part of the image from being cut off. // // Note that the magic 20px comes from SetBezelStyleFromBorderFlags() - // defined in src/osx/cocoa/button.mm. - if ( bitmapSize.y < 20 ) - best += wxSize(4,0); + // defined in src/osx/cocoa/button.mm and so do the style checks. + switch ( GetWindowStyle() & wxBORDER_MASK ) + { + case wxBORDER_NONE: + case wxBORDER_SIMPLE: + break; + + default: + if ( bitmapSize.y < 20 ) + best += wxSize(4,0); + break; + } } return best;