Commit 183c41b4 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Store the global cursor position in the server.

parent ac4aac74
......@@ -231,7 +231,22 @@ BOOL WINAPI GetCursorInfo( PCURSORINFO pci )
*/
BOOL WINAPI DECLSPEC_HOTPATCH SetCursorPos( INT x, INT y )
{
return USER_Driver->pSetCursorPos( x, y );
BOOL ret;
SERVER_START_REQ( set_cursor )
{
req->flags = SET_CURSOR_POS;
req->x = x;
req->y = y;
if ((ret = !wine_server_call( req )))
{
x = reply->new_x;
y = reply->new_y;
}
}
SERVER_END_REQ;
if (ret) ret = USER_Driver->pSetCursorPos( x, y );
return ret;
}
......
......@@ -4769,15 +4769,20 @@ struct set_cursor_request
unsigned int flags;
user_handle_t handle;
int show_count;
int x;
int y;
};
struct set_cursor_reply
{
struct reply_header __header;
user_handle_t prev_handle;
int prev_count;
int new_x;
int new_y;
};
#define SET_CURSOR_HANDLE 0x01
#define SET_CURSOR_COUNT 0x02
#define SET_CURSOR_POS 0x04
enum request
......@@ -5525,6 +5530,6 @@ union generic_reply
struct set_cursor_reply set_cursor_reply;
};
#define SERVER_PROTOCOL_VERSION 412
#define SERVER_PROTOCOL_VERSION 413
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -3290,9 +3290,14 @@ enum coords_relative
unsigned int flags; /* flags for fields to set (see below) */
user_handle_t handle; /* handle to the cursor */
int show_count; /* show count increment/decrement */
int x; /* cursor position */
int y;
@REPLY
user_handle_t prev_handle; /* previous handle */
int prev_count; /* previous show count */
int new_x; /* new position */
int new_y;
@END
#define SET_CURSOR_HANDLE 0x01
#define SET_CURSOR_COUNT 0x02
#define SET_CURSOR_POS 0x04
......@@ -1237,8 +1237,9 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i
/* find the window that should receive a given hardware message */
static user_handle_t find_hardware_message_window( struct thread_input *input, struct message *msg,
struct hardware_msg_data *data, unsigned int *msg_code )
unsigned int *msg_code )
{
struct hardware_msg_data *data = msg->data;
user_handle_t win = 0;
*msg_code = msg->msg;
......@@ -1264,15 +1265,23 @@ static user_handle_t find_hardware_message_window( struct thread_input *input, s
}
/* queue a hardware message into a given thread input */
static void queue_hardware_message( struct thread_input *input, struct message *msg,
struct hardware_msg_data *data )
static void queue_hardware_message( struct desktop *desktop, struct thread_input *input,
struct message *msg )
{
user_handle_t win;
struct thread *thread;
unsigned int msg_code;
struct hardware_msg_data *data = msg->data;
if (msg->msg == WM_MOUSEMOVE)
{
desktop->cursor_x = data->x;
desktop->cursor_y = data->y;
}
data->x = desktop->cursor_x;
data->y = desktop->cursor_y;
last_input_time = get_tick_count();
win = find_hardware_message_window( input, msg, data, &msg_code );
win = find_hardware_message_window( input, msg, &msg_code );
if (!win || !(thread = get_window_thread(win)))
{
if (input) update_input_key_state( input, msg );
......@@ -1361,7 +1370,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
struct hardware_msg_data *data = msg->data;
ptr = list_next( &input->msg_list, ptr );
win = find_hardware_message_window( input, msg, data, &msg_code );
win = find_hardware_message_window( input, msg, &msg_code );
if (!win || !(win_thread = get_window_thread( win )))
{
/* no window at all, remove it */
......@@ -1748,7 +1757,7 @@ DECL_HANDLER(send_hardware_message)
msg->result = NULL;
msg->data = data;
msg->data_size = sizeof(*data);
queue_hardware_message( input, msg, data );
queue_hardware_message( desktop, input, msg );
}
else free( data );
......@@ -2286,10 +2295,17 @@ DECL_HANDLER(set_cursor)
}
input->cursor = req->handle;
}
if (req->flags & SET_CURSOR_COUNT)
{
queue->cursor_count += req->show_count;
input->cursor_count += req->show_count;
}
if (req->flags & SET_CURSOR_POS)
{
input->desktop->cursor_x = req->x;
input->desktop->cursor_y = req->y;
}
reply->new_x = input->desktop->cursor_x;
reply->new_y = input->desktop->cursor_y;
}
......@@ -2100,10 +2100,14 @@ C_ASSERT( sizeof(struct free_user_handle_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_request, flags) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_request, handle) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_request, show_count) == 20 );
C_ASSERT( sizeof(struct set_cursor_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_request, x) == 24 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_request, y) == 28 );
C_ASSERT( sizeof(struct set_cursor_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_handle) == 8 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_count) == 12 );
C_ASSERT( sizeof(struct set_cursor_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, new_x) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, new_y) == 20 );
C_ASSERT( sizeof(struct set_cursor_reply) == 24 );
#endif /* WANT_REQUEST_HANDLERS */
......
......@@ -3871,12 +3871,16 @@ static void dump_set_cursor_request( const struct set_cursor_request *req )
fprintf( stderr, " flags=%08x", req->flags );
fprintf( stderr, ", handle=%08x", req->handle );
fprintf( stderr, ", show_count=%d", req->show_count );
fprintf( stderr, ", x=%d", req->x );
fprintf( stderr, ", y=%d", req->y );
}
static void dump_set_cursor_reply( const struct set_cursor_reply *req )
{
fprintf( stderr, " prev_handle=%08x", req->prev_handle );
fprintf( stderr, ", prev_count=%d", req->prev_count );
fprintf( stderr, ", new_x=%d", req->new_x );
fprintf( stderr, ", new_y=%d", req->new_y );
}
static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
......
......@@ -63,6 +63,8 @@ struct desktop
struct timeout_user *close_timeout; /* timeout before closing the desktop */
struct thread_input *foreground_input; /* thread input of foreground thread */
unsigned int users; /* processes and threads using this desktop */
int cursor_x; /* cursor position */
int cursor_y;
};
/* user handles functions */
......
......@@ -232,6 +232,8 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned
desktop->close_timeout = NULL;
desktop->foreground_input = NULL;
desktop->users = 0;
desktop->cursor_x = 0;
desktop->cursor_y = 0;
list_add_tail( &winstation->desktops, &desktop->entry );
}
}
......
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