Toolbar ReleaseCapture changes

Duane Clark dclark at
Wed Mar 13 13:40:20 CST 2002

These are comments about the patch that I submitted. Since it is a 
fairly significant change, and I don't yet have much of a track record 
(and am admittedly not a programmer by training or profession) I thought 
some detailed comments were in order.

I have two applications, Xilinx fpga_editor and Actel designer, where 
the toolbars did not work. They were drawn fine, tooltips worked, and 
when clicked, they put messages into the status bar indicating what they 
were supposed to do. But the actual actions were never performed.

Tracing the apps, I found that what was happening was that upon 
LBUTTONUP, the applications for whatever reason explicitly called 
ReleaseCapture() before TOOLBAR_LButtonUp() was executed. This caused 
TOOLBAR_LButtonUp() to be called with infoPtr->bCaptured == 0 and 
infoPtr->nButtonDown == -1, as would be expected. However, this also 
caused almost all of the code in the routine to be skipped, since most 
of it is contained within the large if(){} section.

So I got ControlSpy and figured out how to get that to compile and run 
(under Borland C++Builder), and was able to modify it to explicitly call 
ReleaseCapture() before the TOOLBAR_LButtonUp(). This I did in the 
routine GetMsgProc() in ControlSpy, by testing for the correct hwnd and 
message before explicitely calling ReleaseCapture. I kind of expected 
CallWndProc() to be the right place, but it did not seem to be, and I 
really don't understand it well enough yet to know why.

In any case, running this modified version (and the original version to 
compare results) under WinNT, I saw that the when ReleaseCapture is 
explicitely called before TOOLBAR_LButtonUp(), that all the same 
messages and notifications are still generated, with the exception that 
WM_CAPTURECHANGED does not get sent. And that is as expected, since it 
was already sent by the explicit call to ReleaseCapture().

So the patch modifies TOOLBAR_LButtonUp() to duplicate this behavior. It 
fixes both of the apps that were having the toolbar problem, and in the 
case of fpga_editor, it supports rebar and the toolbar continues to 
work. And I have tested it on a half dozen other apps, and all seem to 
be working fine.

More information about the wine-devel mailing list