Commit ababea0f authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

user32: DragDetect() should enter its message loop only if the left mouse button is pressed.

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: 's avatarDmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 35532015
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment