Commit 9f8d9eef authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winex11: Set the window cursor immediately in SetCursor.

Instead of synchronizing the cursor on mouse changes. The SetCursor call should now only be made when cursor or window handle have changed.
parent b17b77c7
......@@ -123,9 +123,6 @@ static const UINT button_up_data[NB_BUTTONS] =
XContext cursor_context = 0;
static HWND cursor_window;
static HCURSOR last_cursor;
static DWORD last_cursor_change;
static RECT last_clip_rect;
static HWND last_clip_foreground_window;
static BOOL last_clip_refused;
......@@ -231,24 +228,6 @@ void set_window_cursor( Window window, HCURSOR handle )
XFlush( gdi_display );
}
/***********************************************************************
* sync_window_cursor
*/
void sync_window_cursor( Window window )
{
HCURSOR cursor;
SERVER_START_REQ( set_cursor )
{
req->flags = 0;
wine_server_call( req );
cursor = reply->prev_count >= 0 ? wine_server_ptr_handle( reply->prev_handle ) : 0;
}
SERVER_END_REQ;
set_window_cursor( window, cursor );
}
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
/***********************************************************************
* update_relative_valuators
......@@ -377,6 +356,7 @@ static BOOL grab_clipping_window( const RECT *clip )
UNICODE_STRING class_name = RTL_CONSTANT_STRING( messageW );
Window clip_window;
HWND msg_hwnd = 0;
HCURSOR cursor;
POINT pos;
if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId())
......@@ -432,6 +412,17 @@ static BOOL grab_clipping_window( const RECT *clip )
GrabModeAsync, GrabModeAsync, clip_window, None, CurrentTime ))
clipping_cursor = TRUE;
SERVER_START_REQ( set_cursor )
{
req->flags = 0;
wine_server_call( req );
if (reply->prev_count < 0) cursor = 0;
else cursor = wine_server_ptr_handle( reply->prev_handle );
}
SERVER_END_REQ;
set_window_cursor( clip_window, cursor );
if (!clipping_cursor)
{
disable_xinput2();
......@@ -439,8 +430,6 @@ static BOOL grab_clipping_window( const RECT *clip )
return FALSE;
}
clip_rect = *clip;
if (!data->clip_hwnd) sync_window_cursor( clip_window );
InterlockedExchangePointer( (void **)&cursor_window, msg_hwnd );
data->clip_hwnd = msg_hwnd;
return TRUE;
#else
......@@ -554,7 +543,6 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x
static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPUT *input )
{
struct x11drv_win_data *data;
Window win = 0;
input->type = INPUT_MOUSE;
......@@ -565,25 +553,12 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
if (!clip_hwnd) return;
if (thread_data->clip_window != window) return;
if (InterlockedExchangePointer( (void **)&cursor_window, clip_hwnd ) != clip_hwnd ||
input->u.mi.time - last_cursor_change > 100)
{
sync_window_cursor( window );
last_cursor_change = input->u.mi.time;
}
__wine_send_input( hwnd, input, NULL );
return;
}
if (!(data = get_win_data( hwnd ))) return;
win = data->whole_window;
release_win_data( data );
if (InterlockedExchangePointer( (void **)&cursor_window, hwnd ) != hwnd ||
input->u.mi.time - last_cursor_change > 100)
{
sync_window_cursor( win );
last_cursor_change = input->u.mi.time;
}
/* update the wine server Z-order */
......@@ -1404,13 +1379,15 @@ void X11DRV_DestroyCursorIcon( HCURSOR handle )
*/
void X11DRV_SetCursor( HWND hwnd, HCURSOR handle )
{
if (InterlockedExchangePointer( (void **)&last_cursor, handle ) != handle ||
NtGetTickCount() - last_cursor_change > 100)
struct x11drv_win_data *data;
if ((data = get_win_data( hwnd )))
{
last_cursor_change = NtGetTickCount();
if (cursor_window) send_notify_message( cursor_window, WM_X11DRV_SET_CURSOR,
GetCurrentThreadId(), (LPARAM)handle );
set_window_cursor( data->whole_window, handle );
release_win_data( data );
}
if (clipping_cursor) set_window_cursor( x11drv_thread_data()->clip_window, handle );
}
/***********************************************************************
......
......@@ -1666,8 +1666,6 @@ static void create_whole_window( struct x11drv_win_data *data )
XFlush( data->display ); /* make sure the window exists before we start painting to it */
sync_window_cursor( data->whole_window );
done:
if (win_rgn) NtGdiDeleteObjectApp( win_rgn );
}
......@@ -3064,27 +3062,6 @@ LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
release_win_data( data );
}
return 0;
case WM_X11DRV_SET_CURSOR:
{
Window win = 0;
if ((data = get_win_data( hwnd )))
{
win = data->whole_window;
release_win_data( data );
}
else if (hwnd == x11drv_thread_data()->clip_hwnd)
win = x11drv_thread_data()->clip_window;
if (win)
{
if (wp == GetCurrentThreadId())
set_window_cursor( win, (HCURSOR)lp );
else
sync_window_cursor( win );
}
return 0;
}
case WM_X11DRV_DELETE_TAB:
taskbar_delete_tab( hwnd );
return 0;
......
......@@ -586,7 +586,6 @@ enum x11drv_window_messages
WM_X11DRV_UPDATE_CLIPBOARD = 0x80001000,
WM_X11DRV_SET_WIN_REGION,
WM_X11DRV_DESKTOP_RESIZED,
WM_X11DRV_SET_CURSOR,
WM_X11DRV_DELETE_TAB,
WM_X11DRV_ADD_TAB
};
......@@ -679,7 +678,6 @@ extern XContext cursor_context DECLSPEC_HIDDEN;
extern void X11DRV_SetFocus( HWND hwnd ) DECLSPEC_HIDDEN;
extern void set_window_cursor( Window window, HCURSOR handle ) DECLSPEC_HIDDEN;
extern void sync_window_cursor( Window window ) DECLSPEC_HIDDEN;
extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN;
extern void move_resize_window( HWND hwnd, int dir ) DECLSPEC_HIDDEN;
extern void X11DRV_InitKeyboard( Display *display ) DECLSPEC_HIDDEN;
......
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