server: Only send WM_WINE_CLIPCURSOR for forced clip resets. (resend)

Sebastian Lackner sebastian at fds-team.de
Tue Nov 10 22:30:50 CST 2015


Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---

For https://bugs.winehq.org/show_bug.cgi?id=33479. Unfortunately there was
no feedback on the last attempt, so not sure if a different approach would
be preferred.

A similar version of the patch was tested in the Staging tree for some time:
https://github.com/wine-compholio/wine-staging/blob/master/patches/server-ClipCursor/0001-server-Only-send-WM_WINE_CLIPCURSOR-for-forced-clip-.patch

Currently the X11DRV_ClipCursor function will be called twice, one time
in the application thread (after the clip_cursor wineserver call), and a
second time in the desktop thread. This confuses the logic in winex11
(depending on the exact timing):

[0009 = app thread, 0015 = desktop thread]

0009:fixme:cursor:ClipCursor Clipping to (0,0)-(1920,1080)
0009:fixme:cursor:X11DRV_ClipCursor Clipping to (0,0)-(1920,1080)
[...]
0015:fixme:msg:handle_internal_message got WM_WINE_CLIPCURSOR
0015:fixme:cursor:X11DRV_ClipCursor Clipping to (0,0)-(1920,1080)
0015:fixme:cursor:X11DRV_ClipCursor data->clip_hwnd == NULL
0015:fixme:cursor:ungrab_clipping_window no longer clipping

Maybe I'm wrong, but it seems unintentional that the function is executed
twice - especially when taking into account that winex11 implements its own
communication mechanism with WM_X11DRV_CLIP_CURSOR messages.

It would be nice if someone familiar with winemac.drv could confirm/test that
removing the duplicate notification doesn't break anything.

 server/queue.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/queue.c b/server/queue.c
index 13ca2b2..5136f43 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -374,7 +374,7 @@ static void get_message_defaults( struct msg_queue *queue, int *x, int *y, unsig
 }
 
 /* set the cursor clip rectangle */
-static void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect )
+static void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, int send_clip_msg )
 {
     rectangle_t top_rect;
     int x, y;
@@ -392,7 +392,7 @@ static void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect
     }
     else desktop->cursor.clip = top_rect;
 
-    if (desktop->cursor.clip_msg)
+    if (desktop->cursor.clip_msg && send_clip_msg)
         post_desktop_message( desktop, desktop->cursor.clip_msg, rect != NULL, 0 );
 
     /* warp the mouse to be inside the clip rect */
@@ -405,7 +405,7 @@ static void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect
 static void set_foreground_input( struct desktop *desktop, struct thread_input *input )
 {
     if (desktop->foreground_input == input) return;
-    set_clip_rectangle( desktop, NULL );
+    set_clip_rectangle( desktop, NULL, 1 );
     desktop->foreground_input = input;
 }
 
@@ -3091,7 +3091,7 @@ DECL_HANDLER(set_cursor)
         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 );
+        set_clip_rectangle( desktop, (req->flags & SET_CURSOR_NOCLIP) ? NULL : &req->clip, 0 );
     }
 
     reply->new_x       = input->desktop->cursor.x;
-- 
2.6.2



More information about the wine-patches mailing list