From d47dbe9faa54acebd8f0072d32eb55d7ad7482f5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 16 Jan 2019 01:50:44 +0100 Subject: [PATCH] Take into account enabled state when drawing themed borders Pass ETS_DISABLED instead of ETS_NORMAL when the window is disabled. --- src/msw/window.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index bdeb6400f2..522a544b88 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -3738,7 +3738,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, hTheme, GetHdcOf(*impl), EP_EDITTEXT, - ETS_NORMAL, + IsEnabled() ? ETS_NORMAL : ETS_DISABLED, rect, &rcClient) == S_OK ) { @@ -3774,21 +3774,22 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, wxCopyRectToRECT(GetSize(), rcBorder); RECT rcClient; + + const int nState = IsEnabled() ? ETS_NORMAL : ETS_DISABLED; ::GetThemeBackgroundContentRect( - hTheme, GetHdcOf(*impl), EP_EDITTEXT, ETS_NORMAL, &rcBorder, &rcClient); + hTheme, GetHdcOf(*impl), EP_EDITTEXT, nState, &rcBorder, &rcClient); InflateRect(&rcClient, -1, -1); ::ExcludeClipRect(GetHdcOf(*impl), rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); // Make sure the background is in a proper state - if (::IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL)) + if (::IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, nState)) { ::DrawThemeParentBackground(GetHwnd(), GetHdcOf(*impl), &rcBorder); } // Draw the border - const int nState = IsEnabled() ? ETS_NORMAL : ETS_DISABLED; ::DrawThemeBackground(hTheme, GetHdcOf(*impl), EP_EDITTEXT, nState, &rcBorder, NULL); } }