Nikolay Sivov : comctl32/toolbar: Send BN_CLICKED for button that was pressed, not released.

Alexandre Julliard julliard at winehq.org
Mon Feb 18 15:43:31 CST 2019


Module: wine
Branch: master
Commit: f3775ed2ac13ade19a4603f5fba558064311f0b7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f3775ed2ac13ade19a4603f5fba558064311f0b7

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Feb 17 01:33:10 2019 +0300

comctl32/toolbar: Send BN_CLICKED for button that was pressed, not released.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35516
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/toolbar.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index f4bdb60..b0c1fb5 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -5733,7 +5733,10 @@ TOOLBAR_LButtonUp (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
         TOOLBAR_SendNotify(&hdr, infoPtr, TBN_TOOLBARCHANGE);
     }
-    else if (infoPtr->nButtonDown >= 0) {
+    else if (infoPtr->nButtonDown >= 0)
+    {
+        BOOL was_clicked = nHit == infoPtr->nButtonDown;
+
 	btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
 	btnPtr->fsState &= ~TBSTATE_PRESSED;
 
@@ -5775,7 +5778,7 @@ TOOLBAR_LButtonUp (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 	TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
 			TBN_ENDDRAG);
 
-	if (btnPtr->fsState & TBSTATE_ENABLED)
+	if (was_clicked && btnPtr->fsState & TBSTATE_ENABLED)
 	{
 	    SendMessageW (infoPtr->hwndNotify, WM_COMMAND,
 	      MAKEWPARAM(infoPtr->buttons[nHit].idCommand, BN_CLICKED), (LPARAM)infoPtr->hwndSelf);




More information about the wine-cvs mailing list