Commit 21e86f60 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Post a message to the desktop window when the cursor clip rectangle changes.

parent 85358b10
......@@ -1717,7 +1717,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH ClipCursor( const RECT *rect )
SERVER_START_REQ( set_cursor )
{
req->flags = SET_CURSOR_CLIP;
req->flags = SET_CURSOR_CLIP;
req->clip_msg = WM_WINE_CLIPCURSOR;
if (rect)
{
req->clip.left = rect->left;
......
......@@ -1869,6 +1869,12 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR
return call_current_hook( h_extra->handle, HC_ACTION, wparam, h_extra->lparam );
}
case WM_WINE_CLIPCURSOR:
{
RECT rect;
GetClipCursor( &rect );
return USER_Driver->pClipCursor( &rect );
}
default:
if (msg >= WM_WINE_FIRST_DRIVER_MSG && msg <= WM_WINE_LAST_DRIVER_MSG)
return USER_Driver->pWindowMessage( hwnd, msg, wparam, lparam );
......
......@@ -47,6 +47,7 @@ enum wine_internal_message
WM_WINE_SETACTIVEWINDOW,
WM_WINE_KEYBOARD_LL_HOOK,
WM_WINE_MOUSE_LL_HOOK,
WM_WINE_CLIPCURSOR,
WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */
WM_WINE_LAST_DRIVER_MSG = 0x80001fff
};
......
......@@ -197,7 +197,6 @@ void xinerama_init( unsigned int width, unsigned int height )
wine_dbgstr_rect(&rect), screen_width, screen_height );
wine_tsx11_unlock();
ClipCursor( NULL ); /* reset the cursor clip rectangle */
}
......
......@@ -4798,6 +4798,8 @@ struct set_cursor_request
int x;
int y;
rectangle_t clip;
unsigned int clip_msg;
char __pad_52[4];
};
struct set_cursor_reply
{
......@@ -5561,6 +5563,6 @@ union generic_reply
struct set_cursor_reply set_cursor_reply;
};
#define SERVER_PROTOCOL_VERSION 418
#define SERVER_PROTOCOL_VERSION 419
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -334,6 +334,7 @@ void manage_desktop( WCHAR *arg )
if (name) set_desktop_window_title( hwnd, name );
SystemParametersInfoA( SPI_SETDESKPATTERN, -1, NULL, FALSE );
SetDeskWallPaper( (LPSTR)-1 );
ClipCursor( NULL );
initialize_display_settings( hwnd );
initialize_appbar();
initialize_systray( using_root );
......
......@@ -3318,6 +3318,7 @@ enum coords_relative
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 */
......
......@@ -318,11 +318,23 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_
return 1;
}
/* set the cursor clip rectangle */
static void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect )
{
rectangle_t top_rect, new_rect;
get_top_window_rectangle( desktop, &top_rect );
if (!rect || !intersect_rect( &new_rect, &top_rect, rect )) new_rect = top_rect;
if (!memcmp( &desktop->cursor.clip, &new_rect, sizeof(new_rect) )) return;
desktop->cursor.clip = new_rect;
if (desktop->cursor.clip_msg) post_desktop_message( desktop, desktop->cursor.clip_msg, 0, 0 );
}
/* change the foreground input and reset the cursor clip rect */
static void set_foreground_input( struct desktop *desktop, struct thread_input *input )
{
if (desktop->foreground_input == input) return;
get_top_window_rectangle( desktop, &desktop->cursor.clip );
set_clip_rectangle( desktop, NULL );
desktop->foreground_input = input;
}
......@@ -2620,10 +2632,13 @@ DECL_HANDLER(set_cursor)
}
if (req->flags & SET_CURSOR_CLIP)
{
rectangle_t top_rect;
get_top_window_rectangle( input->desktop, &top_rect );
if (!intersect_rect( &input->desktop->cursor.clip, &top_rect, &req->clip ))
input->desktop->cursor.clip = top_rect;
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->clip );
}
reply->new_x = input->desktop->cursor.x;
......
......@@ -2097,7 +2097,8 @@ C_ASSERT( FIELD_OFFSET(struct set_cursor_request, show_count) == 20 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_request, x) == 24 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_request, y) == 28 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_request, clip) == 32 );
C_ASSERT( sizeof(struct set_cursor_request) == 48 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_request, clip_msg) == 48 );
C_ASSERT( sizeof(struct set_cursor_request) == 56 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_handle) == 8 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_count) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, new_x) == 16 );
......
......@@ -3896,6 +3896,7 @@ static void dump_set_cursor_request( const struct set_cursor_request *req )
fprintf( stderr, ", x=%d", req->x );
fprintf( stderr, ", y=%d", req->y );
dump_rectangle( ", clip=", &req->clip );
fprintf( stderr, ", clip_msg=%08x", req->clip_msg );
}
static void dump_set_cursor_reply( const struct set_cursor_reply *req )
......
......@@ -56,6 +56,7 @@ 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 */
};
......
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