Use proper directory names for ClipCursor patchsets.

This commit is contained in:
Sebastian Lackner
2017-06-25 05:15:48 +02:00
parent 1b5a0095b8
commit 735a9982cc
6 changed files with 26 additions and 26 deletions

View File

@ -0,0 +1,133 @@
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: 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 | 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 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 )
return CallNextHookEx( 0, code, wparam, lparam );
}
+static LRESULT CALLBACK hook_proc3( int code, WPARAM wparam, LPARAM lparam )
+{
+ POINT pt;
+
+ if (code == HC_ACTION)
+ {
+ /* MSLLHOOKSTRUCT does not seem to be reliable and contains different data on each run. */
+ GetCursorPos(&pt);
+ ok(pt.x == pt_old.x && pt.y == pt_old.y, "GetCursorPos: (%d,%d)\n", pt.x, pt.y);
+ }
+ return CallNextHookEx( 0, code, wparam, lparam );
+}
+
static void test_mouse_ll_hook(void)
{
HWND hwnd;
@@ -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);
+ hook1 = SetWindowsHookExA(WH_MOUSE_LL, hook_proc3, GetModuleHandleA(0), 0);
+
+ SetRect(&rc, 150, 150, 150, 150);
+ ClipCursor(&rc);
+ clipped = TRUE;
+
+ SetCursorPos(140, 140);
+ GetCursorPos(&pt_old);
+ 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;
+ ClipCursor(NULL);
+
+ SetCursorPos(140, 140);
+ SetRect(&rc, 150, 150, 150, 150);
+ ClipCursor(&rc);
+ GetCursorPos(&pt_old);
+ ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+ ClipCursor(NULL);
+
+ SetCursorPos(160, 160);
+ SetRect(&rc, 150, 150, 150, 150);
+ ClipCursor(&rc);
+ 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);
+ ClipCursor(NULL);
+
+ SetCursorPos(150, 150);
+ SetRect(&rc, 150, 150, 150, 150);
+ ClipCursor(&rc);
+ 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);
+ ClipCursor(NULL);
+
+ UnhookWindowsHookEx(hook1);
+
done:
DestroyWindow(hwnd);
SetCursorPos(pt_org.x, pt_org.y);
diff --git a/server/queue.c b/server/queue.c
index 58803fa2c9f..941fcb6a307 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -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 );
- 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

View File

@ -1,75 +0,0 @@
From ee44b1946cb7001cb47d43a60b3e37d9185705de Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 10 Mar 2015 04:29:04 +0100
Subject: winex11: Forward all clipping requests to the right thread (including
fullscreen clipping).
---
dlls/winex11.drv/mouse.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 5f5bdeb..bc20965 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -446,6 +446,8 @@ void reset_clipping_window(void)
ClipCursor( NULL ); /* make sure the clip rectangle is reset too */
}
+BOOL CDECL X11DRV_ClipCursor( LPCRECT clip );
+
/***********************************************************************
* clip_cursor_notify
*
@@ -474,12 +476,10 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd )
}
else if (hwnd == GetForegroundWindow()) /* request to clip */
{
- RECT clip, virtual_rect = get_virtual_screen_rect();
+ RECT clip;
GetClipCursor( &clip );
- if (clip.left > virtual_rect.left || clip.right < virtual_rect.right ||
- clip.top > virtual_rect.top || clip.bottom < virtual_rect.bottom)
- return grab_clipping_window( &clip );
+ X11DRV_ClipCursor( &clip );
}
return 0;
}
@@ -1391,22 +1391,22 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
if (grab_pointer)
{
HWND foreground = GetForegroundWindow();
+ DWORD tid, pid;
+
+ /* forward request to the foreground window if it's in a different thread */
+ tid = GetWindowThreadProcessId( foreground, &pid );
+ if (tid && tid != GetCurrentThreadId() && pid == GetCurrentProcessId())
+ {
+ TRACE( "forwarding clip request to %p\n", foreground );
+ SendNotifyMessageW( foreground, WM_X11DRV_CLIP_CURSOR, 0, 0 );
+ return TRUE;
+ }
/* we are clipping if the clip rectangle is smaller than the screen */
if (clip->left > virtual_rect.left || clip->right < virtual_rect.right ||
clip->top > virtual_rect.top || clip->bottom < virtual_rect.bottom)
{
- DWORD tid, pid;
-
- /* forward request to the foreground window if it's in a different thread */
- tid = GetWindowThreadProcessId( foreground, &pid );
- if (tid && tid != GetCurrentThreadId() && pid == GetCurrentProcessId())
- {
- TRACE( "forwarding clip request to %p\n", foreground );
- SendNotifyMessageW( foreground, WM_X11DRV_CLIP_CURSOR, 0, 0 );
- return TRUE;
- }
- else if (grab_clipping_window( clip )) return TRUE;
+ if (grab_clipping_window( clip )) return TRUE;
}
else /* if currently clipping, check if we should switch to fullscreen clipping */
{
--
2.3.1

View File

@ -1 +1,2 @@
Fixes: [38087] Fix multithreading issues with fullscreen clipping
Fixes: [38791] Fix handling of cursor position clipping
# FIXME: Related to bug 42631?