From 84edda2ba0cb985d4107c6eab40c8b6914a8bcdb Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Fri, 22 Nov 2019 00:02:46 +0100 Subject: [PATCH] Fix wxSpinCtrl arrow position in RTL layout and High DPI Just use hardcoded 2px overlap between the text control and the spin buttons, as it doesn't seem to depend on the DPI and works in both LTR and RTL modes, unlike the existing code, which claimed to work but actually didn't. Closes https://github.com/wxWidgets/wxWidgets/pull/1660 --- src/msw/spinctrl.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index f5f7c442f1..01cc251835 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -728,17 +728,9 @@ bool wxSpinCtrl::MSWOnNotify(int WXUNUSED(idCtrl), WXLPARAM lParam, WXLPARAM *re int wxSpinCtrl::GetOverlap() const { - if ( !GetHwnd() ) - { - // We can be called from GetSizeFromTextSize() before the window is - // created and still need to return something reasonable in this case, - // so return the overlap equal to the default border size. - return FromDIP(2); - } - - // The sign here is correct because the button is positioned inside its - // buddy window. - return wxGetWindowRect(m_hwndBuddy).right - wxGetWindowRect(GetHwnd()).left; + // Don't use FromDIP here. The gap between the control border and the + // button seems to be always 1px. + return 2; } wxSize wxSpinCtrl::DoGetBestSize() const