Commit b1368179 authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

winex11.drv: Only events with MOUSEEVENTF_MOVE flag should change mouse position.

parent 5ff75115
......@@ -568,7 +568,7 @@ static LRESULT CALLBACK hook_proc2( int code, WPARAM wparam, LPARAM lparam )
if (code == HC_ACTION)
{
ok(hook->pt.x == pt_new.x && hook->pt.y == pt_new.y,
"Wrong hook coords: (%d,%d)\n", pt_new.x, pt_new.y);
"Wrong hook coords: (%d %d) != (%d,%d)\n", hook->pt.x, hook->pt.y, pt_new.x, pt_new.y);
/* Should match position set above */
GetCursorPos(&pt);
......@@ -582,7 +582,7 @@ static void test_mouse_ll_hook(void)
{
HWND hwnd;
HHOOK hook1, hook2;
POINT pt_org;
POINT pt_org, pt;
GetCursorPos(&pt_org);
hwnd = CreateWindow("static", "Title", WS_OVERLAPPEDWINDOW,
......@@ -607,6 +607,27 @@ static void test_mouse_ll_hook(void)
ok(pt_old.x == pt_new.x && pt_old.y == pt_new.y, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
UnhookWindowsHookEx(hook1);
/* Now check that mouse buttons do not change mouse position
if we don't have MOUSEEVENTF_MOVE flag specified. */
/* We reusing the same hook callback, so make it happy */
pt_old.x = pt_new.x - STEP;
pt_old.y = pt_new.y - STEP;
mouse_event(MOUSEEVENTF_LEFTUP, 123, 456, 0, 0);
GetCursorPos(&pt);
ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%d,%d)\n", pt.x, pt.y);
mouse_event(MOUSEEVENTF_RIGHTUP, 456, 123, 0, 0);
GetCursorPos(&pt);
ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%d,%d)\n", pt.x, pt.y);
mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE, 123, 456, 0, 0);
GetCursorPos(&pt);
ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%d,%d)\n", pt.x, pt.y);
mouse_event(MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_ABSOLUTE, 456, 123, 0, 0);
GetCursorPos(&pt);
ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%d,%d)\n", pt.x, pt.y);
UnhookWindowsHookEx(hook2);
DestroyWindow(hwnd);
SetCursorPos(pt_org.x, pt_org.y);
......
......@@ -216,7 +216,7 @@ void X11DRV_send_mouse_input( HWND hwnd, DWORD flags, DWORD x, DWORD y,
{
POINT pt;
if (flags & MOUSEEVENTF_ABSOLUTE)
if (flags & MOUSEEVENTF_MOVE && flags & MOUSEEVENTF_ABSOLUTE)
{
if (injected_flags & LLMHF_INJECTED)
{
......@@ -227,6 +227,9 @@ void X11DRV_send_mouse_input( HWND hwnd, DWORD flags, DWORD x, DWORD y,
{
pt.x = x;
pt.y = y;
wine_tsx11_lock();
if (cursor_pos.x == x && cursor_pos.y == y) flags &= ~MOUSEEVENTF_MOVE;
wine_tsx11_unlock();
}
wine_tsx11_lock();
cursor_pos = pt;
......@@ -748,7 +751,7 @@ void X11DRV_ButtonPress( HWND hwnd, XEvent *xev )
update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
X11DRV_send_mouse_input( hwnd, button_down_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE,
X11DRV_send_mouse_input( hwnd, button_down_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
pt.x, pt.y, wData, EVENT_x11_time_to_win32_time(event->time), 0, 0 );
}
......@@ -778,7 +781,7 @@ void X11DRV_ButtonRelease( HWND hwnd, XEvent *xev )
update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
X11DRV_send_mouse_input( hwnd, button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE,
X11DRV_send_mouse_input( hwnd, button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
pt.x, pt.y, wData, EVENT_x11_time_to_win32_time(event->time), 0, 0 );
}
......
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