Call ReleaseCapture (which triggers WM_CAPTURECHANGED) after the

WM_COMMAND for the button has been sent, rather than before.
This commit is contained in:
Susan Farley 2000-09-29 00:24:54 +00:00 committed by Alexandre Julliard
parent 5767f63026
commit ced43b914d
1 changed files with 7 additions and 11 deletions

View File

@ -314,9 +314,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
rc = btnPtr->rect; rc = btnPtr->rect;
CopyRect (&rcArrow, &rc); CopyRect (&rcArrow, &rc);
InflateRect(&rc, -1, -1);
FillRect( hdc, &rc, GetSysColorBrush(COLOR_BTNFACE)); FillRect( hdc, &rc, GetSysColorBrush(COLOR_BTNFACE));
InflateRect(&rc, 1, 1);
if (hasDropDownArrow) if (hasDropDownArrow)
{ {
@ -3454,7 +3452,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
CopyRect(&arrowRect, &btnPtr->rect); CopyRect(&arrowRect, &btnPtr->rect);
arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH); arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH);
/* if click is in the drop-down arrow rect, tell app to show the listbox */ /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */
if ((btnPtr->fsStyle & TBSTYLE_DROPDOWN) && if ((btnPtr->fsStyle & TBSTYLE_DROPDOWN) &&
!(TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && !PtInRect(&arrowRect, pt))) !(TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && !PtInRect(&arrowRect, pt)))
{ {
@ -3506,8 +3504,6 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->buttons[infoPtr->nHotItem].bHot = TRUE; infoPtr->buttons[infoPtr->nHotItem].bHot = TRUE;
if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) { if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) {
infoPtr->bCaptured = FALSE;
ReleaseCapture ();
btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
btnPtr->fsState &= ~TBSTATE_PRESSED; btnPtr->fsState &= ~TBSTATE_PRESSED;
@ -3540,14 +3536,16 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_HasText(infoPtr, &infoPtr->buttons[nOldIndex])); TOOLBAR_HasText(infoPtr, &infoPtr->buttons[nOldIndex]));
} }
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, /*
btnPtr)); * now we can ReleaseCapture, which triggers CAPTURECHANGED msg,
* that resets bCaptured and btn TBSTATE_PRESSED flags,
* and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged)
*/
ReleaseCapture ();
if (bSendMessage) if (bSendMessage)
SendMessageA (GetParent(hwnd), WM_COMMAND, SendMessageA (GetParent(hwnd), WM_COMMAND,
MAKEWPARAM(btnPtr->idCommand, 0), (LPARAM)hwnd); MAKEWPARAM(btnPtr->idCommand, 0), (LPARAM)hwnd);
infoPtr->nButtonDown = -1;
infoPtr->nOldHit = -1;
} }
return 0; return 0;
@ -3559,14 +3557,12 @@ TOOLBAR_CaptureChanged(HWND hwnd)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TBUTTON_INFO *btnPtr; TBUTTON_INFO *btnPtr;
ERR("reset CAPTURE, btnDown=%d\n", infoPtr->nButtonDown);
infoPtr->bCaptured = FALSE; infoPtr->bCaptured = FALSE;
if (infoPtr->nButtonDown >= 0) if (infoPtr->nButtonDown >= 0)
{ {
btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
btnPtr->fsState &= ~TBSTATE_PRESSED; btnPtr->fsState &= ~TBSTATE_PRESSED;
ERR("reset PRESSED\n");
infoPtr->nButtonDown = -1; infoPtr->nButtonDown = -1;
infoPtr->nOldHit = -1; infoPtr->nOldHit = -1;