From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/cursoricon.c | 1 - include/wine/server_protocol.h | 1 - server/protocol.def | 1 - server/queue.c | 9 ++------- server/user.h | 1 - 5 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/dlls/win32u/cursoricon.c b/dlls/win32u/cursoricon.c index bf4b1c3ac23..584a2cffca7 100644 --- a/dlls/win32u/cursoricon.c +++ b/dlls/win32u/cursoricon.c @@ -174,7 +174,6 @@ BOOL WINAPI NtUserClipCursor( const RECT *rect )
SERVER_START_REQ( set_cursor ) { - req->clip_msg = WM_WINE_CLIPCURSOR; if (rect) { req->flags = SET_CURSOR_CLIP; diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 45a50106408..a424f6fcee8 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -5333,7 +5333,6 @@ struct set_cursor_request int x; int y; rectangle_t clip; - unsigned int clip_msg; char __pad_52[4]; }; struct set_cursor_reply diff --git a/server/protocol.def b/server/protocol.def index 95ddb1d5011..800319e8901 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3699,7 +3699,6 @@ struct handle_info int x; /* cursor position */ int y; rectangle_t clip; /* cursor clip rectangle */ - unsigned int clip_msg; /* message to post on cursor clip changes */ @REPLY user_handle_t prev_handle; /* previous handle */ int prev_count; /* previous show count */ diff --git a/server/queue.c b/server/queue.c index 7320dddc6b7..586f0c99696 100644 --- a/server/queue.c +++ b/server/queue.c @@ -34,6 +34,7 @@ #include "wingdi.h" #include "winuser.h" #include "winternl.h" +#include "ntuser.h"
#include "handle.h" #include "file.h" @@ -467,8 +468,7 @@ static void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect } else desktop->cursor.clip = top_rect;
- if (desktop->cursor.clip_msg && send_clip_msg) - post_desktop_message( desktop, desktop->cursor.clip_msg, rect != NULL, 0 ); + if (send_clip_msg) post_desktop_message( desktop, WM_WINE_CLIPCURSOR, rect != NULL, 0 );
/* warp the mouse to be inside the clip rect */ x = max( min( desktop->cursor.x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); @@ -3294,11 +3294,6 @@ DECL_HANDLER(set_cursor) if (req->flags & (SET_CURSOR_CLIP | SET_CURSOR_NOCLIP)) { struct desktop *desktop = input->desktop; - - /* only the desktop owner can set the message */ - if (req->clip_msg && get_top_window_owner(desktop) == current->process) - desktop->cursor.clip_msg = req->clip_msg; - set_clip_rectangle( desktop, (req->flags & SET_CURSOR_NOCLIP) ? NULL : &req->clip, 0 ); }
diff --git a/server/user.h b/server/user.h index 280da454d07..530e91c0c09 100644 --- a/server/user.h +++ b/server/user.h @@ -57,7 +57,6 @@ struct global_cursor int x; /* cursor position */ int y; rectangle_t clip; /* cursor clip rectangle */ - unsigned int clip_msg; /* message to post for cursor clip changes */ unsigned int last_change; /* time of last position change */ user_handle_t win; /* window that contains the cursor */ };
From: Rémi Bernon rbernon@codeweavers.com
--- server/queue.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/server/queue.c b/server/queue.c index 586f0c99696..22842ff286f 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3264,14 +3264,16 @@ DECL_HANDLER(set_cursor) { struct msg_queue *queue = get_current_queue(); struct thread_input *input; + struct desktop *desktop;
if (!queue) return; input = queue->input; + desktop = input->desktop;
reply->prev_handle = input->cursor; reply->prev_count = input->cursor_count; - reply->prev_x = input->desktop->cursor.x; - reply->prev_y = input->desktop->cursor.y; + reply->prev_x = desktop->cursor.x; + reply->prev_y = desktop->cursor.y;
if (req->flags & SET_CURSOR_HANDLE) { @@ -3287,20 +3289,14 @@ DECL_HANDLER(set_cursor) queue->cursor_count += req->show_count; input->cursor_count += req->show_count; } - if (req->flags & SET_CURSOR_POS) - { - set_cursor_pos( input->desktop, req->x, req->y ); - } - if (req->flags & (SET_CURSOR_CLIP | SET_CURSOR_NOCLIP)) - { - struct desktop *desktop = input->desktop; - set_clip_rectangle( desktop, (req->flags & SET_CURSOR_NOCLIP) ? NULL : &req->clip, 0 ); - } + if (req->flags & SET_CURSOR_POS) set_cursor_pos( desktop, req->x, req->y ); + if (req->flags & SET_CURSOR_CLIP) set_clip_rectangle( desktop, &req->clip, 0 ); + if (req->flags & SET_CURSOR_NOCLIP) set_clip_rectangle( desktop, NULL, 0 );
- reply->new_x = input->desktop->cursor.x; - reply->new_y = input->desktop->cursor.y; - reply->new_clip = input->desktop->cursor.clip; - reply->last_change = input->desktop->cursor.last_change; + reply->new_x = desktop->cursor.x; + reply->new_y = desktop->cursor.y; + reply->new_clip = desktop->cursor.clip; + reply->last_change = desktop->cursor.last_change; }
/* Get the history of the 64 last cursor positions */
I'm not completely sure if passing the message to wineserver like that is intentional of it it's only there for historical reasons, as far as I understand the message is always used and always the same.
My intention here is to use wineserver instead of the desktop process to track the clipping thread, and move more of the asynchronous cursor clipping mechanism to wineserver:
* to trigger actual cursor grabs (replacing the WM_X11DRV_CLIP_CURSOR_REQUEST message),
* to trigger cursor releases (replacing the WM_X11DRV_CLIP_CURSOR_NOTIFY mechanism),
* and ultimately moving fullscreen window clipping optional support entirely to win32u (also replacing WM_X11DRV_CLIP_CURSOR_REQUEST).
This will ultimately help getting entirely rid of the winex11 clip_hwnd window, which causes some performance hit when ClipCursor is often called with alternating rectangles (as the window gets re-created).
Later, I think that these messages would be sent to a dedicated input thread, whenever it gets introduced, to also avoid relying on application threads checking their messages, and to avoid tainting some application thread queue with internal message bits.
In the same way, using the input thread, cursor updates could be posted to it, instead of regularly calling sync_window_cursor and removing the need of a clip_hwnd entirely.
---------
Alternatively sending the messages could perhaps be done outside of wineserver, but I think there's still a need for it when thread input are destroyed, although maybe resetting the cursor clip rectangle in SetForegroundWindow / SetActiveWindow could be enough.