Toolbar ReleaseCapture changes

Duane Clark dclark at akamail.com
Wed Mar 13 13:05:41 CST 2002


Since this is likely to receive a fair amount of scrutiny :-), I will 
post some detailed comments about it to wine-devel.

Also, it is my intention (as suggested by Uwe) to release all my patches 
to both forks, as long as the other fork does not adopt the "anything 
but LPGL" model. If that happens, I will stick with this fork.

Log message:
	TOOLBAR_LButtonUp should work even if ReleaseCapture was
	already called.


-------------- next part --------------
Index: dlls/comctl32/toolbar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/toolbar.c,v
retrieving revision 1.105
diff -u -r1.105 toolbar.c
--- dlls/comctl32/toolbar.c	2002/02/27 01:22:58	1.105
+++ dlls/comctl32/toolbar.c	2002/03/13 18:52:57
@@ -4361,18 +4361,16 @@
     if((infoPtr->nHotItem >= 0) && (nHit != -1))
         infoPtr->buttons[infoPtr->nHotItem].bHot = TRUE;
 
-    if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) {
 	btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
 	btnPtr->fsState &= ~TBSTATE_PRESSED;
 
-	if (nHit == infoPtr->nButtonDown) {
-	    if (btnPtr->fsStyle & TBSTYLE_CHECK) {
+	if (btnPtr->fsStyle & TBSTYLE_CHECK) {
 		if (btnPtr->fsStyle & TBSTYLE_GROUP) {
 		    nOldIndex = TOOLBAR_GetCheckedGroupButtonIndex (infoPtr,
-			infoPtr->nButtonDown);
-		    if (nOldIndex == infoPtr->nButtonDown)
+			nHit);
+		    if (nOldIndex == nHit)
 			bSendMessage = FALSE;
-		    if ((nOldIndex != infoPtr->nButtonDown) && 
+		    if ((nOldIndex != nHit) && 
 			(nOldIndex != -1))
 			infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED;
 		    btnPtr->fsState |= TBSTATE_CHECKED;
@@ -4383,10 +4381,7 @@
 		    else
 			btnPtr->fsState |= TBSTATE_CHECKED;
 		}
-	    }
 	}
-	else
-	    bSendMessage = FALSE;
 
 	if (nOldIndex != -1)
         {
@@ -4399,7 +4394,8 @@
 	 * that resets bCaptured and btn TBSTATE_PRESSED flags,
 	 * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged) 
 	 */
-	ReleaseCapture ();
+	if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0))
+	    ReleaseCapture ();
 
 	/* Issue NM_RELEASEDCAPTURE to parent to let him know it is released */
 	TOOLBAR_SendNotify ((NMHDR *) &hdr, infoPtr,
@@ -4420,9 +4416,8 @@
 	TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
 			TBN_ENDDRAG);
 
-	if (bSendMessage)
-	    SendMessageA (infoPtr->hwndNotify, WM_COMMAND,
-			  MAKEWPARAM(btnPtr->idCommand, 0), (LPARAM)hwnd);
+	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.
@@ -4432,8 +4427,6 @@
 	nmmouse.dwItemData = btnPtr->dwData;
 	TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr,
 			NM_CLICK);
-    }
-
     return 0;
 }
 


More information about the wine-patches mailing list