As Carlos pointed out a few days ago, disabled toolbar buttons were still active on some apps. So I did testing with ControlSpy, and matched the messages for both active and inactive toolbar buttons. This patches matches the messages, and fixes several apps so the disabled buttons behave correctly. Changelog: Correct the behavior for disabled toolbar buttons.
Index: dlls/comctl32/toolbar.c =================================================================== RCS file: /home/wine/wine/dlls/comctl32/toolbar.c,v retrieving revision 1.120 diff -u -r1.120 toolbar.c --- dlls/comctl32/toolbar.c 6 Sep 2002 19:41:17 -0000 1.120 +++ dlls/comctl32/toolbar.c 19 Oct 2002 19:05:59 -0000 @@ -4759,16 +4759,13 @@ if (nHit >= 0) { RECT arrowRect; btnPtr = &infoPtr->buttons[nHit]; - if (!(btnPtr->fsState & TBSTATE_ENABLED)) - return 0; - infoPtr->nOldHit = nHit; CopyRect(&arrowRect, &btnPtr->rect); arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH); /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */ - if ((btnPtr->fsStyle & TBSTYLE_DROPDOWN) && + if ((btnPtr->fsState & TBSTATE_ENABLED) && (btnPtr->fsStyle & TBSTYLE_DROPDOWN) && ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) || (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle)))) { @@ -4799,8 +4796,8 @@ btnPtr->fsState |= TBSTATE_PRESSED; btnPtr->bHot = FALSE; - InvalidateRect(hwnd, &btnPtr->rect, - TOOLBAR_HasText(infoPtr, btnPtr)); + if (btnPtr->fsState & TBSTATE_ENABLED) + InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr)); UpdateWindow(hwnd); SetCapture (hwnd); @@ -4882,6 +4879,7 @@ */ if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) ReleaseCapture (); + infoPtr->nButtonDown = -1; /* Issue NM_RELEASEDCAPTURE to parent to let him know it is released */ TOOLBAR_SendNotify ((NMHDR *) &hdr, infoPtr, @@ -4902,17 +4900,19 @@ TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_ENDDRAG); - SendMessageA (infoPtr->hwndNotify, WM_COMMAND, - MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd); + if (btnPtr->fsState & TBSTATE_ENABLED) + { + SendMessageA (infoPtr->hwndNotify, WM_COMMAND, + MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd); - /* !!! Undocumented - toolbar at 4.71 level and above sends - * either NMRCLICK or NM_CLICK with the NMMOUSE structure. - * Only NM_RCLICK is documented. - */ - nmmouse.dwItemSpec = btnPtr->idCommand; - nmmouse.dwItemData = btnPtr->dwData; - TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr, - NM_CLICK); + /* !!! Undocumented - toolbar at 4.71 level and above sends + * either NMRCLICK or NM_CLICK with the NMMOUSE structure. + * Only NM_RCLICK is documented. + */ + nmmouse.dwItemSpec = btnPtr->idCommand; + nmmouse.dwItemData = btnPtr->dwData; + TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr, NM_CLICK); + } return 0; } @@ -4929,11 +4929,11 @@ btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; btnPtr->fsState &= ~TBSTATE_PRESSED; - infoPtr->nButtonDown = -1; infoPtr->nOldHit = -1; - InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, - btnPtr)); + if (btnPtr->fsState & TBSTATE_ENABLED) + InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, + btnPtr)); } return 0; }