From 06948ebccf6d1471561e34824209ed3a9a07ba2a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 6 Apr 2011 12:35:11 +0200 Subject: [PATCH] winex11: Update the cursor on the clip window when the pointer grab starts. --- dlls/winex11.drv/mouse.c | 11 ++++------- dlls/winex11.drv/window.c | 10 ++-------- dlls/winex11.drv/x11drv.h | 3 +-- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index e7e8d62a16b..eb903cd1d5e 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -194,7 +194,7 @@ void set_window_cursor( Window window, HCURSOR handle ) /*********************************************************************** * sync_window_cursor */ -void sync_window_cursor( struct x11drv_win_data *data ) +void sync_window_cursor( Window window ) { HCURSOR cursor; @@ -206,11 +206,7 @@ void sync_window_cursor( struct x11drv_win_data *data ) } SERVER_END_REQ; - if (data->cursor != cursor) - { - data->cursor = cursor; - set_window_cursor( data->whole_window, cursor ); - } + set_window_cursor( window, cursor ); } /*********************************************************************** @@ -253,7 +249,7 @@ static void send_mouse_input( HWND hwnd, UINT flags, Window window, int x, int y if (InterlockedExchangePointer( (void **)&cursor_window, hwnd ) != hwnd || GetTickCount() - last_cursor_change > 100) { - sync_window_cursor( data ); + sync_window_cursor( data->whole_window ); last_cursor_change = GetTickCount(); } @@ -964,6 +960,7 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip ) if (clipping_cursor) { + sync_window_cursor( clip_window ); clip_rect = *clip; return TRUE; } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index e35547a2608..648ed598d9e 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1715,10 +1715,7 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat XFlush( display ); /* make sure the window exists before we start painting to it */ wine_tsx11_unlock(); - sync_window_cursor( data ); - /* setting the cursor can fail if the window isn't created yet */ - /* so make sure that we try again once we receive a mouse event */ - data->cursor = (HANDLE)~0u; + sync_window_cursor( data->whole_window ); done: if (win_rgn) DeleteObject( win_rgn ); @@ -2701,10 +2698,7 @@ LRESULT CDECL X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) return 0; case WM_X11DRV_SET_CURSOR: if ((data = X11DRV_get_win_data( hwnd )) && data->whole_window) - { - data->cursor = (HCURSOR)lp; - set_window_cursor( data->whole_window, data->cursor ); - } + set_window_cursor( data->whole_window, (HCURSOR)lp ); return 0; default: FIXME( "got window msg %x hwnd %p wp %lx lp %lx\n", msg, hwnd, wp, lp ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 986d03abe36..867d9fe0479 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -771,7 +771,6 @@ struct x11drv_win_data RECT whole_rect; /* X window rectangle for the whole window relative to parent */ RECT client_rect; /* client area relative to parent */ XIC xic; /* X input context */ - HCURSOR cursor; /* current cursor */ XWMHints *wm_hints; /* window manager hints */ BOOL managed : 1; /* is window managed? */ BOOL mapped : 1; /* is window mapped? (in either normal or iconic state) */ @@ -822,7 +821,7 @@ extern void X11DRV_Clipboard_Cleanup(void); extern void X11DRV_ResetSelectionOwner(void); extern void CDECL X11DRV_SetFocus( HWND hwnd ); extern void set_window_cursor( Window window, HCURSOR handle ); -extern void sync_window_cursor( struct x11drv_win_data *data ); +extern void sync_window_cursor( Window window ); extern BOOL CDECL X11DRV_ClipCursor( LPCRECT clip ); extern void X11DRV_InitKeyboard( Display *display ); extern DWORD CDECL X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,