There's an application that calls DragDetect() on every WM_MOUSEMOVE message, and this breaks handling of mouse events. A simple test app shows that on Windows DragDetect() starts its message loop when left mouse button is pressed.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/user32/tests/win.c | 17 +++++++++++++++++ dlls/user32/win.c | 10 ++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 6b13d93be14..88989f4064b 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -12293,6 +12293,22 @@ static void test_cancel_mode(void) DestroyWindow(hwnd2); }
+static void test_DragDetect(void) +{ + POINT pt; + BOOL ret; + + ok(!GetCapture(), "got capture window %p\n", GetCapture()); + ok(!(GetKeyState( VK_LBUTTON ) & 0x8000), "got VK_LBUTTON\n"); + + GetCursorPos(&pt); + ret = DragDetect(hwndMain, pt); + ok(!ret, "got %d\n", ret); + + ok(!GetCapture(), "got capture window %p\n", GetCapture()); + ok(!(GetKeyState( VK_LBUTTON ) & 0x8000), "got VK_LBUTTON\n"); +} + START_TEST(win) { char **argv; @@ -12461,6 +12477,7 @@ START_TEST(win) test_other_process_window(argv[0]); test_SC_SIZE(); test_cancel_mode(); + test_DragDetect();
/* add the tests above this line */ if (hhook) UnhookWindowsHookEx(hhook); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 4d0240f21a8..3c6810f4200 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -3893,9 +3893,15 @@ BOOL WINAPI DragDetect( HWND hWnd, POINT pt ) { MSG msg; RECT rect; - WORD wDragWidth = GetSystemMetrics(SM_CXDRAG); - WORD wDragHeight= GetSystemMetrics(SM_CYDRAG); + WORD wDragWidth, wDragHeight;
+ TRACE( "%p,%s\n", hWnd, wine_dbgstr_point( &pt ) ); + + if (!(GetKeyState( VK_LBUTTON ) & 0x8000)) + return FALSE; + + wDragWidth = GetSystemMetrics(SM_CXDRAG); + wDragHeight= GetSystemMetrics(SM_CYDRAG); SetRect(&rect, pt.x - wDragWidth, pt.y - wDragHeight, pt.x + wDragWidth, pt.y + wDragHeight);
SetCapture(hWnd);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=100685
Your paranoid android.
=== w1064v1809 (32 bit report) ===
user32: win.c:4013: Test failed: message 0738 available
=== w1064_tsign (32 bit report) ===
user32: win.c:4073: Test failed: hwnd 00020178/00020178 message 0200 win.c:4077: Test failed: hwnd 00020178/00020178 message 0201 win.c:4086: Test failed: hwnd 0011005A/0011005A message 0202 win.c:4089: Test failed: hwnd 0011005A/0011005A message 0201
=== w10pro64 (32 bit report) ===
user32: win.c:2271: Test failed: style 0x200000: expected !100 win.c:2271: Test failed: style 0x300000: expected !100
=== w10pro64 (64 bit report) ===
user32: win.c:2271: Test failed: style 0x200000: expected !100 win.c:2271: Test failed: style 0x300000: expected !100
=== w10pro64_zh_CN (64 bit report) ===
user32: win.c:10245: Test failed: pos = 00fa00fa win.c:10249: Test failed: pos = 00fa00fa win.c:10253: Test failed: pos = 00fa00fa
=== debiant2 (64 bit WoW report) ===
user32: menu.c:2337: Test failed: test 25
Marvin testbot@winehq.org wrote:
=== w1064v1809 (32 bit report) ===
user32: win.c:4013: Test failed: message 0738 available
=== w1064_tsign (32 bit report) ===
user32: win.c:4073: Test failed: hwnd 00020178/00020178 message 0200 win.c:4077: Test failed: hwnd 00020178/00020178 message 0201 win.c:4086: Test failed: hwnd 0011005A/0011005A message 0202 win.c:4089: Test failed: hwnd 0011005A/0011005A message 0201
=== w10pro64 (32 bit report) ===
user32: win.c:2271: Test failed: style 0x200000: expected !100 win.c:2271: Test failed: style 0x300000: expected !100
=== w10pro64 (64 bit report) ===
user32: win.c:2271: Test failed: style 0x200000: expected !100 win.c:2271: Test failed: style 0x300000: expected !100
=== w10pro64_zh_CN (64 bit report) ===
user32: win.c:10245: Test failed: pos = 00fa00fa win.c:10249: Test failed: pos = 00fa00fa win.c:10253: Test failed: pos = 00fa00fa
=== debiant2 (64 bit WoW report) ===
user32: menu.c:2337: Test failed: test 25
These failures don't seem to be related to the patch.