From 3fc3a33f589c636b4f651613f667562fbdf3c9ef Mon Sep 17 00:00:00 2001 From: Steve Cornett <21205494+stevecor@users.noreply.github.com> Date: Mon, 8 Jun 2026 08:09:53 -0700 Subject: [PATCH] Add wxWindow::MSWGetBorderThickness() This function is more convenient to use in MSW-specific code than GetWindowBorderSize() as it returns the size of a single border and so doesn't require the caller to divide the return value by 2. No real changes. See #26571. --- include/wx/msw/window.h | 2 ++ src/msw/window.cpp | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 5442fcceec..771de072c1 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -794,6 +794,8 @@ private: bool MSWSafeIsDialogMessage(WXMSG* msg); #endif // __WXUNIVERSAL__ + int MSWGetBorderThickness() const; + static inline bool MSWIsPositionDirectlySupported(int x, int y) { // The supported coordinate intervals for various functions are: diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 6c80a6f4c4..44a8a43f41 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2274,23 +2274,20 @@ void wxWindowMSW::DoSetClientSize(int width, int height) } } -wxSize wxWindowMSW::GetWindowBorderSize() const +int wxWindowMSW::MSWGetBorderThickness() const { - wxCoord border; switch ( GetBorder() ) { case wxBORDER_STATIC: case wxBORDER_SIMPLE: - border = 1; - break; + return 1; case wxBORDER_SUNKEN: case wxBORDER_THEME: - border = 2; - break; + return 2; case wxBORDER_RAISED: - border = 3; + return 3; break; default: @@ -2298,9 +2295,13 @@ wxSize wxWindowMSW::GetWindowBorderSize() const wxFALLTHROUGH; case wxBORDER_NONE: - border = 0; + return 0; } +} +wxSize wxWindowMSW::GetWindowBorderSize() const +{ + const auto border = MSWGetBorderThickness(); return 2*wxSize(border, border); }