user32-Clip_Cursor: Update patchset.

This commit is contained in:
Sebastian Lackner 2017-06-25 05:12:48 +02:00
parent 12a893e94f
commit 1b5a0095b8
2 changed files with 34 additions and 16 deletions

View File

@ -7907,7 +7907,7 @@ fi
if test "$enable_user32_Clip_Cursor" -eq 1; then
patch_apply user32-Clip_Cursor/0001-server-Fix-handling-of-cursor-position-clipping.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "server: Fix handling of cursor position clipping.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "server: Improve handling of cursor position clipping for empty rectangle.", 2 },';
) >> "$patchlist"
fi

View File

@ -1,15 +1,21 @@
From 62d856626fc8b291bf3590df21d92a15d904598a Mon Sep 17 00:00:00 2001
From da292f2fdfca600a7352cc813f4c1b4428a65869 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 12 Jun 2017 18:47:54 +0200
Subject: server: Fix handling of cursor position clipping.
Subject: server: Improve handling of cursor position clipping for empty
rectangle. (v2)
Based on a patch by Kevin Buhr.
We cannot match the Windows behavior because there is no sane way to emulate
the unusual Windows cursor clipping in winex11/winemac. For now it is better
to keep wineserver and backends synchronized to avoid cursor drift.
---
dlls/user32/tests/input.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++
server/queue.c | 7 +++--
2 files changed, 71 insertions(+), 2 deletions(-)
dlls/user32/tests/input.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++
server/queue.c | 9 +++----
2 files changed, 73 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 87c491657a9..d301fc2b3d2 100644
index a8a8c6c2fe5..5f70c4c1a64 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1278,6 +1278,19 @@ static LRESULT CALLBACK hook_proc2( int code, WPARAM wparam, LPARAM lparam )
@ -32,7 +38,7 @@ index 87c491657a9..d301fc2b3d2 100644
static void test_mouse_ll_hook(void)
{
HWND hwnd;
@@ -1351,6 +1364,59 @@ static void test_mouse_ll_hook(void)
@@ -1351,6 +1364,62 @@ static void test_mouse_ll_hook(void)
ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%d,%d)\n", pt.x, pt.y);
UnhookWindowsHookEx(hook2);
@ -47,18 +53,21 @@ index 87c491657a9..d301fc2b3d2 100644
+ ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+ SetCursorPos(160, 160);
+ GetCursorPos(&pt_old);
+ todo_wine
+ ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+ mouse_event(MOUSEEVENTF_MOVE, -STEP, -STEP, 0, 0);
+ GetCursorPos(&pt_old);
+ ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+ mouse_event(MOUSEEVENTF_MOVE, +STEP, +STEP, 0, 0);
+ GetCursorPos(&pt_old);
+ todo_wine
+ ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+ mouse_event(MOUSEEVENTF_MOVE, 0, 0, 0, 0);
+ GetCursorPos(&pt_old);
+ ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+ mouse_event(MOUSEEVENTF_MOVE, 0, 0, 0, 0);
+ GetCursorPos(&pt_old);
+ todo_wine
+ ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+
+ clipped = FALSE;
@ -93,23 +102,32 @@ index 87c491657a9..d301fc2b3d2 100644
DestroyWindow(hwnd);
SetCursorPos(pt_org.x, pt_org.y);
diff --git a/server/queue.c b/server/queue.c
index 58803fa2c9f..c5921b2d21b 100644
index 58803fa2c9f..941fcb6a307 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1605,8 +1605,11 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
@@ -445,8 +445,8 @@ static void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect
post_desktop_message( desktop, desktop->cursor.clip_msg, rect != NULL, 0 );
/* warp the mouse to be inside the clip rect */
- x = min( max( desktop->cursor.x, desktop->cursor.clip.left ), desktop->cursor.clip.right-1 );
- y = min( max( desktop->cursor.y, desktop->cursor.clip.top ), desktop->cursor.clip.bottom-1 );
+ x = max( min( desktop->cursor.x, desktop->cursor.clip.right-1 ), desktop->cursor.clip.left );
+ y = max( min( desktop->cursor.y, desktop->cursor.clip.bottom-1 ), desktop->cursor.clip.top );
if (x != desktop->cursor.x || y != desktop->cursor.y) set_cursor_pos( desktop, x, y );
}
@@ -1605,9 +1605,8 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
{
if (msg->msg == WM_MOUSEMOVE)
{
- int x = min( max( msg->x, desktop->cursor.clip.left ), desktop->cursor.clip.right-1 );
- int y = min( max( msg->y, desktop->cursor.clip.top ), desktop->cursor.clip.bottom-1 );
+ int x = msg->x, y = msg->y;
+ if (x < desktop->cursor.clip.left) x = desktop->cursor.clip.left;
+ else if (x >= desktop->cursor.clip.right) x = desktop->cursor.clip.right - 1;
+ if (y < desktop->cursor.clip.top) y = desktop->cursor.clip.top;
+ else if (y >= desktop->cursor.clip.bottom) y = desktop->cursor.clip.bottom - 1;
if (desktop->cursor.x != x || desktop->cursor.y != y) always_queue = 1;
- if (desktop->cursor.x != x || desktop->cursor.y != y) always_queue = 1;
+ int x = max( min( msg->x, desktop->cursor.clip.right-1 ), desktop->cursor.clip.left );
+ int y = max( min( msg->y, desktop->cursor.clip.bottom-1 ), desktop->cursor.clip.top );
desktop->cursor.x = x;
desktop->cursor.y = y;
desktop->cursor.last_change = get_tick_count();
--
2.13.1