Commit 098b11e9 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Don't allow setting the cursor across processes while clipping.

parent 5bb094c9
...@@ -420,6 +420,7 @@ static BOOL grab_clipping_window( const RECT *clip, BOOL only_with_xinput ) ...@@ -420,6 +420,7 @@ static BOOL grab_clipping_window( const RECT *clip, BOOL only_with_xinput )
} }
clip_rect = *clip; clip_rect = *clip;
if (!data->clip_hwnd) sync_window_cursor( clip_window ); if (!data->clip_hwnd) sync_window_cursor( clip_window );
InterlockedExchangePointer( (void **)&cursor_window, msg_hwnd );
data->clip_hwnd = msg_hwnd; data->clip_hwnd = msg_hwnd;
SendMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, (LPARAM)msg_hwnd ); SendMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, (LPARAM)msg_hwnd );
return TRUE; return TRUE;
...@@ -542,9 +543,16 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU ...@@ -542,9 +543,16 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
if (!hwnd) if (!hwnd)
{ {
struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_thread_data *thread_data = x11drv_thread_data();
HWND clip_hwnd = thread_data->clip_hwnd;
if (!thread_data->clip_hwnd) return; if (!clip_hwnd) return;
if (thread_data->clip_window != window) return; if (thread_data->clip_window != window) return;
if (InterlockedExchangePointer( (void **)&cursor_window, clip_hwnd ) != clip_hwnd ||
GetTickCount() - last_cursor_change > 100)
{
sync_window_cursor( window );
last_cursor_change = GetTickCount();
}
input->u.mi.dx += clip_rect.left; input->u.mi.dx += clip_rect.left;
input->u.mi.dy += clip_rect.top; input->u.mi.dy += clip_rect.top;
__wine_send_input( hwnd, input ); __wine_send_input( hwnd, input );
...@@ -1215,8 +1223,7 @@ void CDECL X11DRV_SetCursor( HCURSOR handle ) ...@@ -1215,8 +1223,7 @@ void CDECL X11DRV_SetCursor( HCURSOR handle )
GetTickCount() - last_cursor_change > 100) GetTickCount() - last_cursor_change > 100)
{ {
last_cursor_change = GetTickCount(); last_cursor_change = GetTickCount();
if (clipping_cursor) set_window_cursor( init_clip_window(), handle ); if (cursor_window) SendNotifyMessageW( cursor_window, WM_X11DRV_SET_CURSOR, 0, (LPARAM)handle );
else if (cursor_window) SendNotifyMessageW( cursor_window, WM_X11DRV_SET_CURSOR, 0, (LPARAM)handle );
} }
} }
......
...@@ -2699,6 +2699,8 @@ LRESULT CDECL X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -2699,6 +2699,8 @@ LRESULT CDECL X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
case WM_X11DRV_SET_CURSOR: case WM_X11DRV_SET_CURSOR:
if ((data = X11DRV_get_win_data( hwnd )) && data->whole_window) if ((data = X11DRV_get_win_data( hwnd )) && data->whole_window)
set_window_cursor( data->whole_window, (HCURSOR)lp ); set_window_cursor( data->whole_window, (HCURSOR)lp );
else if (hwnd == x11drv_thread_data()->clip_hwnd)
set_window_cursor( x11drv_thread_data()->clip_window, (HCURSOR)lp );
return 0; return 0;
case WM_X11DRV_CLIP_CURSOR: case WM_X11DRV_CLIP_CURSOR:
return clip_cursor_notify( hwnd, (HWND)lp ); return clip_cursor_notify( hwnd, (HWND)lp );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment