 
            From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/datetime.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c index 2772cfec00c..a4084f20cb2 100644 --- a/dlls/comctl32/datetime.c +++ b/dlls/comctl32/datetime.c @@ -43,8 +43,10 @@ #include "winnls.h" #include "commctrl.h" #include "comctl32.h" +#if __WINE_COMCTL32_VERSION == 6 #include "uxtheme.h" #include "vsstyle.h" +#endif #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(datetime); @@ -127,7 +129,6 @@ static BOOL DATETIME_SendSimpleNotify (const DATETIME_INFO *infoPtr, UINT code); static BOOL DATETIME_SendDateTimeChangeNotify (const DATETIME_INFO *infoPtr); static const WCHAR allowedformatchars[] = L"dhHmMstyX"; static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1}; -static const WCHAR *themeClass = WC_SCROLLBARW;
/* valid date limits */ static const SYSTEMTIME max_allowed_date = { .wYear = 9999, .wMonth = 12, .wDayOfWeek = 0, .wDay = 31 }; @@ -710,8 +711,10 @@ static int DATETIME_GetFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int co static void DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc) { +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme; int state; +#endif
TRACE("\n");
@@ -779,6 +782,7 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc) if (infoPtr->dwStyle & DTS_UPDOWN) return;
+#if __WINE_COMCTL32_VERSION == 6 theme = GetWindowTheme(infoPtr->hwndSelf); if (theme) { @@ -794,6 +798,7 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc) DrawThemeBackground(theme, hdc, SBP_ARROWBTN, state, &infoPtr->calbutton, NULL); } else +#endif { DrawFrameControl(hdc, &infoPtr->calbutton, DFC_SCROLL, DFCS_SCROLLDOWN | (infoPtr->bCalDepressed ? DFCS_PUSHED : 0) | @@ -1304,6 +1309,7 @@ DATETIME_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs) return 1; }
+#if __WINE_COMCTL32_VERSION == 6 static LRESULT DATETIME_NCPaint (HWND hwnd, HRGN region) { INT cxEdge, cyEdge; @@ -1346,6 +1352,7 @@ static LRESULT DATETIME_NCPaint (HWND hwnd, HRGN region) DeleteObject(clipRgn); return 0; } +#endif
static LRESULT DATETIME_MouseMove (DATETIME_INFO *infoPtr, LONG x, LONG y) { @@ -1529,16 +1536,18 @@ DATETIME_StyleChanged(DATETIME_INFO *infoPtr, WPARAM wStyleType, const STYLESTRU return 0; }
+#if __WINE_COMCTL32_VERSION == 6 static LRESULT DATETIME_ThemeChanged (DATETIME_INFO *infoPtr) { HTHEME theme;
theme = GetWindowTheme(infoPtr->hwndSelf); CloseThemeData(theme); - OpenThemeData(infoPtr->hwndSelf, themeClass); + OpenThemeData(infoPtr->hwndSelf, WC_SCROLLBARW); InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); return 0; } +#endif
static BOOL DATETIME_GetIdealSize(DATETIME_INFO *infoPtr, SIZE *size) { @@ -1633,7 +1642,9 @@ DATETIME_Create (HWND hwnd, const CREATESTRUCTW *lpcs) infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT);
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); - OpenThemeData(hwnd, themeClass); +#if __WINE_COMCTL32_VERSION == 6 + OpenThemeData(hwnd, WC_SCROLLBARW); +#endif
return 0; } @@ -1643,10 +1654,9 @@ DATETIME_Create (HWND hwnd, const CREATESTRUCTW *lpcs) static LRESULT DATETIME_Destroy (DATETIME_INFO *infoPtr) { - HTHEME theme; - - theme = GetWindowTheme(infoPtr->hwndSelf); - CloseThemeData(theme); +#if __WINE_COMCTL32_VERSION == 6 + CloseThemeData(GetWindowTheme(infoPtr->hwndSelf)); +#endif
if (infoPtr->hwndCheckbut) DestroyWindow(infoPtr->hwndCheckbut); @@ -1773,8 +1783,10 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NCCREATE: return DATETIME_NCCreate (hwnd, (LPCREATESTRUCTW)lParam);
+#if __WINE_COMCTL32_VERSION == 6 case WM_NCPAINT: return DATETIME_NCPaint(hwnd, (HRGN)wParam); +#endif
case WM_MOUSEMOVE: return DATETIME_MouseMove(infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); @@ -1812,8 +1824,10 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_STYLECHANGED: return DATETIME_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam);
+#if __WINE_COMCTL32_VERSION == 6 case WM_THEMECHANGED: return DATETIME_ThemeChanged(infoPtr); +#endif
case WM_SETFONT: return DATETIME_SetFont(infoPtr, (HFONT)wParam, (BOOL)lParam);
 
            From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/header.c | 60 +++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 9 deletions(-)
diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c index 354ca615500..89df914c02d 100644 --- a/dlls/comctl32/header.c +++ b/dlls/comctl32/header.c @@ -38,8 +38,10 @@ #include "winnls.h" #include "commctrl.h" #include "comctl32.h" +#if __WINE_COMCTL32_VERSION == 6 #include "vssym32.h" #include "uxtheme.h" +#endif #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(header); @@ -110,8 +112,6 @@ static void HEADER_FreeCallbackItems(HEADER_ITEM *lpItem); static LRESULT HEADER_SendNotify(const HEADER_INFO *infoPtr, UINT code, NMHDR *hdr); static LRESULT HEADER_SendCtrlCustomDraw(const HEADER_INFO *infoPtr, DWORD dwDrawStage, HDC hdc, const RECT *rect);
-static const WCHAR themeClass[] = L"Header"; - static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDITEMW *phdi, BOOL fUnicode) { if (mask & HDI_UNSUPPORTED_FIELDS) @@ -290,6 +290,7 @@ static void HEADER_GetHotDividerRect(const HEADER_INFO *infoPtr, RECT *r) static void HEADER_FillItemFrame(HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM *item, BOOL hottrack) { +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
if (theme) { @@ -298,6 +299,7 @@ HEADER_FillItemFrame(HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM * GetThemeBackgroundContentRect (theme, hdc, HP_HEADERITEM, state, r, r); } else +#endif { HBRUSH hbr = CreateSolidBrush(GetBkColor(hdc)); FillRect(hdc, r, hbr); @@ -308,7 +310,9 @@ HEADER_FillItemFrame(HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM * static void HEADER_DrawItemFrame(HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM *item) { +#if __WINE_COMCTL32_VERSION == 6 if (GetWindowTheme(infoPtr->hwndSelf)) return; +#endif
if (!(infoPtr->dwStyle & HDS_FLAT)) { @@ -371,9 +375,11 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU HEADER_ITEM *phdi = &infoPtr->items[iItem]; RECT r; INT oldBkMode; - HTHEME theme = GetWindowTheme (infoPtr->hwndSelf); NMCUSTOMDRAW nmcd; +#if __WINE_COMCTL32_VERSION == 6 + HTHEME theme = GetWindowTheme (infoPtr->hwndSelf); int state = 0; +#endif
TRACE("DrawItem(iItem %d bHotTrack %d unicode flag %d)\n", iItem, bHotTrack, (infoPtr->nNotifyFormat == NFR_UNICODE));
@@ -381,11 +387,15 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU if (r.right - r.left == 0) return phdi->rect.right;
+#if __WINE_COMCTL32_VERSION == 6 if (theme) state = (phdi->bDown) ? HIS_PRESSED : (bHotTrack ? HIS_HOT : HIS_NORMAL);
/* Set the colors before sending NM_CUSTOMDRAW so that it can change them */ SetTextColor(hdc, (bHotTrack && !theme) ? comctl32_color.clrHighlight : comctl32_color.clrBtnText); +#else + SetTextColor(hdc, bHotTrack ? comctl32_color.clrHighlight : comctl32_color.clrBtnText); +#endif SetBkColor(hdc, comctl32_color.clr3dFace);
if (lCDFlags & CDRF_NOTIFYITEMDRAW && !(phdi->fmt & HDF_OWNERDRAW)) @@ -465,10 +475,14 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
SetRectEmpty(&textRect);
+#if __WINE_COMCTL32_VERSION == 6 if (theme) { GetThemeTextExtent(theme, hdc, HP_HEADERITEM, state, phdi->pszText, -1, DT_LEFT|DT_VCENTER|DT_SINGLELINE, NULL, &textRect); - } else { + } + else +#endif + { DrawTextW (hdc, phdi->pszText, -1, &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT); } @@ -581,11 +595,15 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU oldBkMode = SetBkMode(hdc, TRANSPARENT); r.left = tx; r.right = tx + tw; +#if __WINE_COMCTL32_VERSION == 6 if (theme) { DrawThemeText(theme, hdc, HP_HEADERITEM, state, phdi->pszText, -1, DT_LEFT|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE, 0, &r); - } else { + } + else +#endif + { DrawTextW (hdc, phdi->pszText, -1, &r, DT_LEFT|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE); } @@ -619,7 +637,9 @@ HEADER_Refresh (HEADER_INFO *infoPtr, HDC hdc) UINT i; INT x; LRESULT lCDFlags; +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf); +#endif
if (!infoPtr->bRectsValid) HEADER_SetItemBounds(infoPtr); @@ -635,7 +655,12 @@ HEADER_Refresh (HEADER_INFO *infoPtr, HDC hdc) hOldFont = SelectObject (hdc, hFont);
/* draw Background */ - if (infoPtr->uNumItem == 0 && theme == NULL) { +#if __WINE_COMCTL32_VERSION == 6 + if (infoPtr->uNumItem == 0 && theme == NULL) +#else + if (infoPtr->uNumItem == 0) +#endif + { hbrBk = GetSysColorBrush(COLOR_3DFACE); FillRect(hdc, &rect, hbrBk); } @@ -651,10 +676,15 @@ HEADER_Refresh (HEADER_INFO *infoPtr, HDC hdc) rcRest = rect; rcRest.left = x; if ((x <= rect.right) && RectVisible(hdc, &rcRest) && (infoPtr->uNumItem > 0)) { +#if __WINE_COMCTL32_VERSION == 6 if (theme != NULL) { DrawThemeBackground(theme, hdc, HP_HEADERITEM, HIS_NORMAL, &rcRest, NULL); } - else if (infoPtr->dwStyle & HDS_FLAT) { + else if (infoPtr->dwStyle & HDS_FLAT) +#else + if (infoPtr->dwStyle & HDS_FLAT) +#endif + { hbrBk = GetSysColorBrush(COLOR_3DFACE); FillRect(hdc, &rcRest, hbrBk); } @@ -1614,7 +1644,9 @@ HEADER_Create (HWND hwnd, const CREATESTRUCTW *lpcs) SelectObject (hdc, hOldFont); ReleaseDC (0, hdc);
- OpenThemeData(hwnd, themeClass); +#if __WINE_COMCTL32_VERSION == 6 + OpenThemeData(hwnd, L"Header"); +#endif
return 0; } @@ -1623,8 +1655,10 @@ HEADER_Create (HWND hwnd, const CREATESTRUCTW *lpcs) static LRESULT HEADER_Destroy (HEADER_INFO *infoPtr) { +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf); CloseThemeData(theme); +#endif return 0; }
@@ -1877,10 +1911,14 @@ HEADER_MouseMove (HEADER_INFO *infoPtr, LPARAM lParam) UINT flags; INT nItem, nWidth; HDC hdc; +#if __WINE_COMCTL32_VERSION == 6 /* With theming, hottracking is always enabled */ BOOL hotTrackEnabled = ((infoPtr->dwStyle & HDS_BUTTONS) && (infoPtr->dwStyle & HDS_HOTTRACK)) || (GetWindowTheme (infoPtr->hwndSelf) != NULL); +#else + BOOL hotTrackEnabled = infoPtr->dwStyle & HDS_BUTTONS && infoPtr->dwStyle & HDS_HOTTRACK; +#endif INT oldHotItem = infoPtr->iHotItem;
pt.x = (INT)(SHORT)LOWORD(lParam); @@ -2108,15 +2146,17 @@ static INT HEADER_StyleChanged(HEADER_INFO *infoPtr, WPARAM wStyleType, return 0; }
+#if __WINE_COMCTL32_VERSION == 6 /* Update the theme handle after a theme change */ static LRESULT HEADER_ThemeChanged(const HEADER_INFO *infoPtr) { HTHEME theme = GetWindowTheme(infoPtr->hwndSelf); CloseThemeData(theme); - OpenThemeData(infoPtr->hwndSelf, themeClass); + OpenThemeData(infoPtr->hwndSelf, L"Header"); InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); return 0; } +#endif
static INT HEADER_SetFilterChangeTimeout(HEADER_INFO *infoPtr, INT timeout) { @@ -2243,8 +2283,10 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_SIZE: return HEADER_Size (infoPtr);
+#if __WINE_COMCTL32_VERSION == 6 case WM_THEMECHANGED: return HEADER_ThemeChanged (infoPtr); +#endif
case WM_PRINTCLIENT: case WM_PAINT:
 
            From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/hotkey.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/comctl32/hotkey.c b/dlls/comctl32/hotkey.c index a3a8a8ce6b4..1a4e5cf9cc7 100644 --- a/dlls/comctl32/hotkey.c +++ b/dlls/comctl32/hotkey.c @@ -38,7 +38,9 @@ #include "winnls.h" #include "commctrl.h" #include "comctl32.h" +#if __WINE_COMCTL32_VERSION == 6 #include "uxtheme.h" +#endif #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(hotkey); @@ -424,6 +426,7 @@ HOTKEY_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs) return DefWindowProcW (infoPtr->hwndSelf, WM_NCCREATE, 0, (LPARAM)lpcs); }
+#if __WINE_COMCTL32_VERSION == 6 static LRESULT HOTKEY_NCPaint (HWND hwnd, HRGN region) { @@ -467,6 +470,7 @@ HOTKEY_NCPaint (HWND hwnd, HRGN region) DeleteObject(clipRgn); return 0; } +#endif
static LRESULT HOTKEY_SetFocus (HOTKEY_INFO *infoPtr) @@ -568,8 +572,10 @@ HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NCCREATE: return HOTKEY_NCCreate (hwnd, (LPCREATESTRUCTW)lParam);
+#if __WINE_COMCTL32_VERSION == 6 case WM_NCPAINT: return HOTKEY_NCPaint (hwnd, (HRGN)wParam); +#endif
case WM_PRINTCLIENT: case WM_PAINT:
 
            From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/ipaddress.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c index af1ae11300e..2e99039e6d3 100644 --- a/dlls/comctl32/ipaddress.c +++ b/dlls/comctl32/ipaddress.c @@ -35,9 +35,11 @@ #include "winnls.h" #include "commctrl.h" #include "comctl32.h" +#if __WINE_COMCTL32_VERSION == 6 #include "uxtheme.h" #include "vsstyle.h" #include "vssym32.h" +#endif #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ipaddress); @@ -138,15 +140,18 @@ static LRESULT IPADDRESS_Draw (const IPADDRESS_INFO *infoPtr, HDC hdc) { RECT rect, rcPart; COLORREF bgCol, fgCol; + int i; +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme; - int i, state = ETS_NORMAL; + int state = ETS_NORMAL; +#endif
TRACE("\n");
GetClientRect (infoPtr->Self, &rect);
+#if __WINE_COMCTL32_VERSION == 6 theme = GetWindowTheme (infoPtr->Self); - if (theme) { DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
@@ -163,7 +168,10 @@ static LRESULT IPADDRESS_Draw (const IPADDRESS_INFO *infoPtr, HDC hdc) if (IsThemeBackgroundPartiallyTransparent (theme, EP_EDITTEXT, state)) DrawThemeParentBackground(infoPtr->Self, hdc, &rect); DrawThemeBackground (theme, hdc, EP_EDITTEXT, state, &rect, 0); - } else { + } + else +#endif + { if (infoPtr->Enabled) { bgCol = comctl32_color.clrWindow; fgCol = comctl32_color.clrWindowText; @@ -187,9 +195,11 @@ static LRESULT IPADDRESS_Draw (const IPADDRESS_INFO *infoPtr, HDC hdc) MapWindowPoints( 0, infoPtr->Self, (POINT *)&rcPart, 2 ); rect.right = rcPart.left;
+#if __WINE_COMCTL32_VERSION == 6 if (theme) DrawThemeText(theme, hdc, EP_EDITTEXT, state, L".", 1, DT_SINGLELINE | DT_CENTER | DT_BOTTOM, 0, &rect); else +#endif DrawTextW(hdc, L".", 1, &rect, DT_SINGLELINE | DT_CENTER | DT_BOTTOM); }
@@ -252,7 +262,9 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate) }
IPADDRESS_UpdateText (infoPtr); +#if __WINE_COMCTL32_VERSION == 6 OpenThemeData (infoPtr->Self, WC_EDITW); +#endif
return 0; } @@ -260,7 +272,6 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate)
static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr) { - HTHEME theme; int i;
TRACE("\n"); @@ -273,8 +284,9 @@ static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr) if (infoPtr->hFont) DeleteObject (infoPtr->hFont); SetWindowLongPtrW (infoPtr->Self, 0, 0); - theme = GetWindowTheme (infoPtr->Self); - CloseThemeData (theme); +#if __WINE_COMCTL32_VERSION == 6 + CloseThemeData (GetWindowTheme (infoPtr->Self)); +#endif Free (infoPtr); return 0; } @@ -459,6 +471,7 @@ static BOOL IPADDRESS_GotoNextField (const IPADDRESS_INFO *infoPtr, int cur, int return FALSE; }
+#if __WINE_COMCTL32_VERSION == 6 static LRESULT IPADDRESS_ThemeChanged (const IPADDRESS_INFO *infoPtr) { HTHEME theme = GetWindowTheme (infoPtr->Self); @@ -467,6 +480,7 @@ static LRESULT IPADDRESS_ThemeChanged (const IPADDRESS_INFO *infoPtr) InvalidateRect (infoPtr->Self, NULL, TRUE); return 0; } +#endif
/* * period: move and select the text in the next field to the right if @@ -629,8 +643,10 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) COMCTL32_RefreshSysColors(); return 0;
+#if __WINE_COMCTL32_VERSION == 6 case WM_THEMECHANGED: return IPADDRESS_ThemeChanged (infoPtr); +#endif
case IPM_CLEARADDRESS: return IPADDRESS_ClearAddress (infoPtr);
 
            From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/listview.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 7f51838f000..62f16359017 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -138,8 +138,10 @@ #include "winnls.h" #include "commctrl.h" #include "comctl32.h" +#if __WINE_COMCTL32_VERSION == 6 #include "uxtheme.h" #include "vsstyle.h" +#endif #include "shlwapi.h"
#include "wine/debug.h" @@ -420,8 +422,6 @@ typedef struct tagLISTVIEW_INFO TRACE("hwndSelf=%p, rcList=%s\n", iP->hwndSelf, wine_dbgstr_rect(&iP->rcList)); \ } while(0)
-static const WCHAR themeClass[] = L"ListView"; - enum key_state { SHIFT_KEY = 0x1, @@ -8559,6 +8559,7 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx) * Creates the checkbox imagelist. Helper for LISTVIEW_SetExtendedListViewStyle * */ +#if __WINE_COMCTL32_VERSION == 6 static HIMAGELIST LISTVIEW_CreateThemedCheckBoxImageList(const LISTVIEW_INFO *info) { HBITMAP bitmap, old_bitmap; @@ -8600,6 +8601,7 @@ static HIMAGELIST LISTVIEW_CreateThemedCheckBoxImageList(const LISTVIEW_INFO *in CloseThemeData(theme); return image_list; } +#endif /* __WINE_COMCTL32_VERSION == 6 */
static HIMAGELIST LISTVIEW_CreateCheckBoxIL(const LISTVIEW_INFO *infoPtr) { @@ -8609,9 +8611,11 @@ static HIMAGELIST LISTVIEW_CreateCheckBoxIL(const LISTVIEW_INFO *infoPtr) HBRUSH hbr_white, hbr_black; HIMAGELIST himl;
+#if __WINE_COMCTL32_VERSION == 6 himl = LISTVIEW_CreateThemedCheckBoxImageList(infoPtr); if (himl) return himl; +#endif
hbr_white = GetStockObject(WHITE_BRUSH); hbr_black = GetStockObject(BLACK_BRUSH); @@ -9468,6 +9472,7 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare, return TRUE; }
+#if __WINE_COMCTL32_VERSION == 6 /*** * DESCRIPTION: * Update theme handle after a theme change. @@ -9483,10 +9488,11 @@ static LRESULT LISTVIEW_ThemeChanged(const LISTVIEW_INFO *infoPtr) { HTHEME theme = GetWindowTheme(infoPtr->hwndSelf); CloseThemeData(theme); - OpenThemeData(infoPtr->hwndSelf, themeClass); + OpenThemeData(infoPtr->hwndSelf, L"ListView"); InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); return 0; } +#endif
/*** * DESCRIPTION: @@ -9711,7 +9717,9 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED) notify_measureitem(infoPtr); }
- OpenThemeData(hwnd, themeClass); +#if __WINE_COMCTL32_VERSION == 6 + OpenThemeData(hwnd, L"ListView"); +#endif
/* initialize the icon sizes */ set_icon_size(&infoPtr->iconSize, infoPtr->himlNormal, infoPtr->uView != LV_VIEW_ICON); @@ -9732,8 +9740,10 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) */ static LRESULT LISTVIEW_Destroy(LISTVIEW_INFO *infoPtr) { +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf); CloseThemeData(theme); +#endif
/* delete all items */ LISTVIEW_DeleteAllItems(infoPtr, TRUE); @@ -10734,6 +10744,7 @@ static LRESULT LISTVIEW_Notify(LISTVIEW_INFO *infoPtr, NMHDR *lpnmhdr) return 0; }
+#if __WINE_COMCTL32_VERSION == 6 /*** * DESCRIPTION: * Paint non-client area of control. @@ -10785,6 +10796,7 @@ static LRESULT LISTVIEW_NCPaint(const LISTVIEW_INFO *infoPtr, HRGN region)
return 0; } +#endif
/*** * DESCRIPTION: @@ -11889,8 +11901,10 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NCDESTROY: return LISTVIEW_NCDestroy(infoPtr);
+#if __WINE_COMCTL32_VERSION == 6 case WM_NCPAINT: return LISTVIEW_NCPaint(infoPtr, (HRGN)wParam); +#endif
case WM_NOTIFY: return LISTVIEW_Notify(infoPtr, (LPNMHDR)lParam); @@ -11936,8 +11950,11 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0;
/* case WM_TIMER: */ + +#if __WINE_COMCTL32_VERSION == 6 case WM_THEMECHANGED: return LISTVIEW_ThemeChanged(infoPtr); +#endif
case WM_VSCROLL: return LISTVIEW_VScroll(infoPtr, (INT)LOWORD(wParam), 0);
 
            Will it be a problem to have WM_THEMECHANGED and WM_NCPAINT (v6 case) as shared helpers?
 
            Nikolay Sivov (@nsivov) commented about dlls/comctl32/datetime.c:
#include "winnls.h" #include "commctrl.h" #include "comctl32.h" +#if __WINE_COMCTL32_VERSION == 6 #include "uxtheme.h" #include "vsstyle.h" +#endif #include "wine/debug.h"
Could you pack this change in comctl32.h instead? This will be a recurring pattern for all controls. Or we could simply leave that unchanged, it shouldn't harm to have more includes than we actually need.
 
            Nikolay Sivov (@nsivov) commented about dlls/comctl32/datetime.c:
static void DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc) { +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme; int state; +#endif
TRACE("\n");
This part, and splitting 'if' branches is what I don't like the most about this. Especially when there multiple places in the same function. Could we maybe have more helpers instead, where conditions are localized within a single function as close as possible.
 
            Nikolay Sivov (@nsivov) commented about dlls/comctl32/datetime.c:
return 0;}
+#if __WINE_COMCTL32_VERSION == 6 static LRESULT DATETIME_ThemeChanged (DATETIME_INFO *infoPtr) { HTHEME theme;
theme = GetWindowTheme(infoPtr->hwndSelf); CloseThemeData(theme);
- OpenThemeData(infoPtr->hwndSelf, themeClass);
- OpenThemeData(infoPtr->hwndSelf, WC_SCROLLBARW); InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); return 0;
} +#endif
As I mentioned before, this should move to a shared helper, which we could them compile out entirely.
 
            On Mon Oct 20 14:32:50 2025 +0000, Nikolay Sivov wrote:
Will it be a problem to have WM_THEMECHANGED and WM_NCPAINT (v6 case) as shared helpers?
For WM_THEMECHANGED, we can have a helper. For WM_NCPAINT, a few comctl32 controls do have the same code. Others handle WM_NCPAINT a bit differently though.
 
            On Mon Oct 20 14:29:02 2025 +0000, Nikolay Sivov wrote:
Could you pack this change in comctl32.h instead? This will be a recurring pattern for all controls. Or we could simply leave that unchanged, it shouldn't harm to have more includes than we actually need.
I will move it to comctl32.h.
 
            On Mon Oct 20 14:29:02 2025 +0000, Nikolay Sivov wrote:
This part, and splitting 'if' branches is what I don't like the most about this. Especially when there multiple places in the same function. Could we maybe have more helpers instead, where conditions are localized within a single function as close as possible.
I will try.
 
            On Mon Oct 20 14:32:50 2025 +0000, Zhiyi Zhang wrote:
For WM_THEMECHANGED, we can have a helper. For WM_NCPAINT, a few comctl32 controls do have the same code. Others handle WM_NCPAINT a bit differently though.
Sure, only where it makes sense and where handlers are currently identical.
 
            On Mon Oct 20 14:34:12 2025 +0000, Zhiyi Zhang wrote:
I will try.
For datetime.c it's enough to reduce scope of those variables to where they are used, so we don't need to comment out declarations separately.


