Fix wxTextCtrl border switching from dark mode

Do not check dark mode in wxTextCtrl::CanApplyThemeBorder(). Instead,
improve the checking for themed border drawing in the WM_NCPAINT
handler.

This fixed the border appearance after switching from dark mode to the
light one.

Closes #26794.
This commit is contained in:
Steve Cornett
2026-08-06 21:57:23 +02:00
committed by Vadim Zeitlin
parent 17e670dd60
commit 4227d13440
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -496,8 +496,8 @@ bool wxTextCtrl::Create(wxWindow *parent,
// returns true if the platform should explicitly apply a theme border
bool wxTextCtrl::CanApplyThemeBorder() const
{
// Standard text control already handles theming in light mode.
return IsRich() || wxMSWDarkMode::IsActive();
// Standard text control already handles theming.
return IsRich();
}
bool wxTextCtrl::MSWCreateText(const wxString& value,
+3 -2
View File
@@ -3836,7 +3836,8 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
{
// Determine whether we should draw a border.
bool drawBorder = false;
wxBorder border = DoTranslateBorder(GetBorder());
wxBorder rawBorder = GetBorder();
wxBorder border = DoTranslateBorder(rawBorder);
switch ( border )
{
case wxBORDER_THEME:
@@ -3882,7 +3883,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
rcClient.right, rcClient.bottom);
// Draw the border.
if ( border == wxBORDER_THEME )
if ( rawBorder == wxBORDER_THEME )
MSWDrawThemeBorder(hdc);
else
{