[PATCH 1/3] comctl32/toolbar: Add support for TBCDRF_NOBACKGROUND.

Zhiyi Zhang wine at gitlab.winehq.org
Mon Jun 20 23:12:02 CDT 2022


From: Zhiyi Zhang <zzhang at codeweavers.com>

Tested manually on XP, Win 7 and Win 10.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53049
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/comctl32/toolbar.c | 31 +++++++++++++++++--------------
 include/commctrl.h      |  2 +-
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 9b059996b65..bea294958c5 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -1062,20 +1062,23 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc,
 
     if (theme)
     {
-        int partId = drawSepDropDownArrow ? TP_SPLITBUTTON : TP_BUTTON;
-        int stateId = TS_NORMAL;
-        
-        if (tbcd.nmcd.uItemState & CDIS_DISABLED)
-            stateId = TS_DISABLED;
-        else if (tbcd.nmcd.uItemState & CDIS_SELECTED)
-            stateId = TS_PRESSED;
-        else if (tbcd.nmcd.uItemState & CDIS_CHECKED)
-            stateId = (tbcd.nmcd.uItemState & CDIS_HOT) ? TS_HOTCHECKED : TS_CHECKED;
-        else if ((tbcd.nmcd.uItemState & CDIS_HOT)
-            || (drawSepDropDownArrow && btnPtr->bDropDownPressed))
-            stateId = TS_HOT;
-            
-        DrawThemeBackground (theme, hdc, partId, stateId, &rc, NULL);
+        if (!(dwItemCDFlag & TBCDRF_NOBACKGROUND))
+        {
+            int partId = drawSepDropDownArrow ? TP_SPLITBUTTON : TP_BUTTON;
+            int stateId = TS_NORMAL;
+
+            if (tbcd.nmcd.uItemState & CDIS_DISABLED)
+                stateId = TS_DISABLED;
+            else if (tbcd.nmcd.uItemState & CDIS_SELECTED)
+                stateId = TS_PRESSED;
+            else if (tbcd.nmcd.uItemState & CDIS_CHECKED)
+                stateId = (tbcd.nmcd.uItemState & CDIS_HOT) ? TS_HOTCHECKED : TS_CHECKED;
+            else if ((tbcd.nmcd.uItemState & CDIS_HOT)
+                     || (drawSepDropDownArrow && btnPtr->bDropDownPressed))
+                stateId = TS_HOT;
+
+            DrawThemeBackground(theme, hdc, partId, stateId, &rc, NULL);
+        }
     }
     else
         TOOLBAR_DrawFrame(infoPtr, &tbcd, &rc, dwItemCDFlag);
diff --git a/include/commctrl.h b/include/commctrl.h
index b829e4498ea..725ef64764f 100644
--- a/include/commctrl.h
+++ b/include/commctrl.h
@@ -1380,7 +1380,7 @@ typedef struct _NMTBCUSTOMDRAW
 #define TBCDRF_NOETCHEDEFFECT 0x00100000  /* No etched effect for          */
                                           /* disabled items                */
 #define TBCDRF_BLENDICON      0x00200000  /* ILD_BLEND50 on the icon image */
-#define TBCDRF_NOBACKGROUND   0x00400000  /* ILD_BLEND50 on the icon image */
+#define TBCDRF_NOBACKGROUND   0x00400000  /* Don't draw button background  */
 #define TBCDRF_USECDCOLORS    0x00800000
 
 
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/288



More information about the wine-devel mailing list