From: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/comctl32/comctl32.h | 1 + dlls/comctl32/commctrl.c | 5 +++++ dlls/comctl32/header.c | 8 ++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/comctl32.h b/dlls/comctl32/comctl32.h index de4b2dac956..ca68906be62 100644 --- a/dlls/comctl32/comctl32.h +++ b/dlls/comctl32/comctl32.h @@ -196,6 +196,7 @@ void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark void COMCTL32_EnsureBitmapSize(HBITMAP *pBitmap, int cxMinWidth, int cyMinHeight, COLORREF crBackground); void COMCTL32_GetFontMetrics(HFONT hFont, TEXTMETRICW *ptm); BOOL COMCTL32_IsReflectedMessage(UINT uMsg); +BOOL COMCTL32_IsThemed(HWND hwnd); LRESULT COMCTL32_NCPaint(HWND hwnd, WPARAM wp, LPARAM lp, const WCHAR *theme_class); LRESULT COMCTL32_SetVersion(INT *current_version, INT new_version); LRESULT COMCTL32_ThemeChanged(HWND hwnd, const WCHAR *theme_class, BOOL invalidate, BOOL erase); diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c index cf5f4b3256a..2aa31ca47f2 100644 --- a/dlls/comctl32/commctrl.c +++ b/dlls/comctl32/commctrl.c @@ -3206,3 +3206,8 @@ LRESULT COMCTL32_NCPaint(HWND hwnd, WPARAM wp, LPARAM lp, const WCHAR *theme_cla return DefWindowProcW(hwnd, WM_NCPAINT, wp, lp); #endif } + +BOOL COMCTL32_IsThemed(HWND hwnd) +{ + return !!GetWindowTheme(hwnd); +} diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c index fd31b98eee3..fd00880c69c 100644 --- a/dlls/comctl32/header.c +++ b/dlls/comctl32/header.c @@ -306,7 +306,7 @@ 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 (GetWindowTheme(infoPtr->hwndSelf)) return; + if (COMCTL32_IsThemed(infoPtr->hwndSelf)) return; if (!(infoPtr->dwStyle & HDS_FLAT)) { @@ -383,7 +383,7 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU 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); + SetTextColor(hdc, (bHotTrack && !COMCTL32_IsThemed(infoPtr->hwndSelf)) ? comctl32_color.clrHighlight : comctl32_color.clrBtnText); SetBkColor(hdc, comctl32_color.clr3dFace); if (lCDFlags & CDRF_NOTIFYITEMDRAW && !(phdi->fmt & HDF_OWNERDRAW)) @@ -633,7 +633,7 @@ HEADER_Refresh (HEADER_INFO *infoPtr, HDC hdc) hOldFont = SelectObject (hdc, hFont); /* draw Background */ - if (infoPtr->uNumItem == 0 && theme == NULL) { + if (infoPtr->uNumItem == 0 && !COMCTL32_IsThemed(infoPtr->hwndSelf)) { hbrBk = GetSysColorBrush(COLOR_3DFACE); FillRect(hdc, &rect, hbrBk); } @@ -1878,7 +1878,7 @@ HEADER_MouseMove (HEADER_INFO *infoPtr, LPARAM lParam) /* With theming, hottracking is always enabled */ BOOL hotTrackEnabled = ((infoPtr->dwStyle & HDS_BUTTONS) && (infoPtr->dwStyle & HDS_HOTTRACK)) - || (GetWindowTheme (infoPtr->hwndSelf) != NULL); + || COMCTL32_IsThemed (infoPtr->hwndSelf); INT oldHotItem = infoPtr->iHotItem; pt.x = (INT)(SHORT)LOWORD(lParam); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9290