On Nov 15, 2015, at 9:40 PM, Christopher Thielen cthielen@gmail.com wrote:
I figured out this behavior. It seems if one calls SetCapture() twice it will cause Windows to send a WM_CAPTURECHANGED message to the same window given as the parameter of SetCapture(). Wine does not currently follow this behavior.
The following patch fixes the behavior, though I'm not sure if it's the right way to fix the issue as I don't know why the original author(s) made the removed check in the first place. Does anyone have any ideas?
(Generated against wine.git on 11/15/15 at 19:28 PST):
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 40e35a9..63fae67 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -108,7 +108,7 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) { USER_Driver->pSetCapture( hwnd, gui_flags );
if (previous && previous != hwnd)
if (previous) SendMessageW( previous, WM_CAPTURECHANGED, 0, (LPARAM)hwnd ); if (prev_ret) *prev_ret = previous;
Have you run the user32 tests with this change in place? Does it break any tests?
Can you write a test for the behavior that you're seeing? Does that test pass on the testbot's Windows VMs?
The history of this code is that it was consolidated from multiple similar code paths that all had that check against the previous and new windows being the same. In particular, it's used by implicit captures, such as with menu tracking and window moving and resizing, as well as explicit captures. You'd want to be sure that those other paths don't break as a result of your change.
Regards, Ken