Commit 79516685 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

comctl32/ipaddress: Do not open theme data in IPADDRESS_Draw().

parent 161649e3
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment