http://bugs.winehq.org/show_bug.cgi?id=22079
--- Comment #9 from LIGHTNING UK! lightning_uk@imgburn.com 2011-06-13 15:45:50 CDT --- Still present in 1.3.22.
If it helps anyone, I put this in an email to Nikolay (but didn't hear back)....
====================================================================
I use the OnMouseDown event and the Windows API function called 'DragDetect'.
After stepping through the VCL code it would appear the important bit of the program 'flow' is as follows:
User right clicks the mouse TControl.WMRButtonDown (calls 'inherited') jumps to TWinControl.WMContextMenu (calls 'inherited') jumps to TControl.WMContextMenu (calls 'TControl.DoContextPopup') jumps to TControl.DoContextPopup (calls ListView's 'OnContextPopup' event) jumps to control's 'OnContextPopup' event (runs my code - shows menu) Once menu has been closed... eventually returns to TControl.WMRButtonDown (calls 'TControl.DoMouseDown') jumps to TControl.DoMouseDown (calls 'TControl.MouseDown') jumps to TControl.MouseDown (calls ListView's 'OnMouseDown' event) jumps to control's 'OnMouseDown' event (runs my code - the 'DragDetect' function)
So in Windows at least, my context menu code runs before anything 'MouseDown' (and therefore 'DragDetect') related.
That aside and for some weird reason, Wine's implementation of 'DragDetect' seems to return 'true' even if the right mouse button was pressed (rather than the left). Windows doesn't do that and it goes against the docs on MSDN which only mention the left button. Even clicking my mouse's scroll wheel/button can make Wine's DragDetect return 'true' - again, this doesn't happen on Windows.
Under Wine, DragDetect returns true instantly if the left mouse button is clicked in 'white space' (not on an item). There's no drag rectangle (threshold) as mentioned in MSDN. If the middle / right buttons were clicked (and held) in 'white space' then it only returns 'true' after the mouse has been moved 1 pixel. It doesn't even matter if you click and release the middle/right button, the second you move the mouse 1 pixel is will register it as a drag event. Likewise, you can click and release AND press escape before moving the mouse 1 pixel and it still registers as a drag event. If you left click (and hold) on an item, you have to move the mouse 1 pixel before it registers as a drag event. Ditto for middle/right buttons.
I'm currently working with a version of the program that logs 'DragDetected' in the Log window whenever 'DragDetect' returns true. If that makes debugging/testing easier for you, I could send a new exe over?
====================================================================