[PATCH 4/5] comctl32/ipaddress: Do not open theme data in IPADDRESS_Draw().
Zhiyi Zhang
zzhang at codeweavers.com
Tue Mar 2 00:47:34 CST 2021
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
dlls/comctl32/ipaddress.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c
index c7b9ada1f6a..b6302a89ba6 100644
--- a/dlls/comctl32/ipaddress.c
+++ b/dlls/comctl32/ipaddress.c
@@ -145,7 +145,7 @@ static LRESULT IPADDRESS_Draw (const IPADDRESS_INFO *infoPtr, HDC hdc)
GetClientRect (infoPtr->Self, &rect);
- theme = OpenThemeData(infoPtr->Self, WC_EDITW);
+ theme = GetWindowTheme (infoPtr->Self);
if (theme) {
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
@@ -193,9 +193,6 @@ static LRESULT IPADDRESS_Draw (const IPADDRESS_INFO *infoPtr, HDC hdc)
DrawTextW(hdc, L".", 1, &rect, DT_SINGLELINE | DT_CENTER | DT_BOTTOM);
}
- if (theme)
- CloseThemeData(theme);
-
return 0;
}
@@ -255,6 +252,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate)
}
IPADDRESS_UpdateText (infoPtr);
+ OpenThemeData (infoPtr->Self, WC_EDITW);
return 0;
}
@@ -262,6 +260,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate)
static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr)
{
+ HTHEME theme;
int i;
TRACE("\n");
@@ -272,6 +271,8 @@ static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr)
}
SetWindowLongPtrW (infoPtr->Self, 0, 0);
+ theme = GetWindowTheme (infoPtr->Self);
+ CloseThemeData (theme);
heap_free (infoPtr);
return 0;
}
@@ -456,6 +457,13 @@ static BOOL IPADDRESS_GotoNextField (const IPADDRESS_INFO *infoPtr, int cur, int
return FALSE;
}
+static LRESULT IPADDRESS_ThemeChanged (const IPADDRESS_INFO *infoPtr)
+{
+ HTHEME theme = GetWindowTheme (infoPtr->Self);
+ CloseThemeData (theme);
+ theme = OpenThemeData (theme, WC_EDITW);
+ return 0;
+}
/*
* period: move and select the text in the next field to the right if
@@ -618,6 +626,9 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
COMCTL32_RefreshSysColors();
return 0;
+ case WM_THEMECHANGED:
+ return IPADDRESS_ThemeChanged (infoPtr);
+
case IPM_CLEARADDRESS:
return IPADDRESS_ClearAddress (infoPtr);
--
2.27.0
More information about the wine-devel
mailing list