Commit 247275ae authored by Alexandre Julliard's avatar Alexandre Julliard

server: Return a valid position also in posted messages.

parent b508c85c
......@@ -2765,8 +2765,8 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
info.msg.wParam = reply->wparam;
info.msg.lParam = reply->lparam;
info.msg.time = reply->time;
info.msg.pt.x = 0;
info.msg.pt.y = 0;
info.msg.pt.x = reply->x;
info.msg.pt.y = reply->y;
hw_id = 0;
thread_info->active_hooks = reply->active_hooks;
}
......@@ -2871,8 +2871,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
{
MSLLHOOKSTRUCT hook;
hook.pt.x = msg_data->hardware.x;
hook.pt.y = msg_data->hardware.y;
hook.pt = info.msg.pt;
hook.mouseData = info.msg.lParam;
hook.flags = msg_data->hardware.flags;
hook.time = info.msg.time;
......@@ -2896,9 +2895,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
case MSG_HARDWARE:
if (size >= sizeof(msg_data->hardware))
{
info.msg.pt.x = msg_data->hardware.x;
info.msg.pt.y = msg_data->hardware.y;
hw_id = msg_data->hardware.hw_id;
hw_id = msg_data->hardware.hw_id;
if (!process_hardware_message( &info.msg, hw_id, &msg_data->hardware,
hwnd, first, last, flags & PM_REMOVE ))
{
......@@ -2940,8 +2937,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
continue; /* ignore it */
}
*msg = info.msg;
msg->pt.x = (short)LOWORD( thread_info->GetMessagePosVal );
msg->pt.y = (short)HIWORD( thread_info->GetMessagePosVal );
thread_info->GetMessagePosVal = MAKELONG( info.msg.pt.x, info.msg.pt.y );
thread_info->GetMessageTimeVal = info.msg.time;
thread_info->GetMessageExtraInfoVal = 0;
HeapFree( GetProcessHeap(), 0, buffer );
......
......@@ -8008,28 +8008,28 @@ static void test_GetMessagePos(void)
GetMessageA(&msg, button, 0, 0);
ok(msg.message == WM_APP, "msg.message = %x\n", msg.message);
pos = GetMessagePos();
todo_wine ok(pos == MAKELONG(340, 320), "pos = %08x\n", pos);
ok(pos == MAKELONG(340, 320), "pos = %08x\n", pos);
PostMessageA(button, WM_APP, 0, 0);
SetCursorPos(350, 330);
GetMessageA(&msg, button, 0, 0);
ok(msg.message == WM_APP, "msg.message = %x\n", msg.message);
pos = GetMessagePos();
todo_wine ok(pos == MAKELONG(340, 320), "pos = %08x\n", pos);
ok(pos == MAKELONG(340, 320), "pos = %08x\n", pos);
PostMessageA(button, WM_APP, 0, 0);
SetCursorPos(320, 340);
PostMessageA(button, WM_APP+1, 0, 0);
pos = GetMessagePos();
todo_wine ok(pos == MAKELONG(340, 320), "pos = %08x\n", pos);
ok(pos == MAKELONG(340, 320), "pos = %08x\n", pos);
GetMessageA(&msg, button, 0, 0);
ok(msg.message == WM_APP, "msg.message = %x\n", msg.message);
pos = GetMessagePos();
todo_wine ok(pos == MAKELONG(350, 330), "pos = %08x\n", pos);
ok(pos == MAKELONG(350, 330), "pos = %08x\n", pos);
GetMessageA(&msg, button, 0, 0);
ok(msg.message == WM_APP+1, "msg.message = %x\n", msg.message);
pos = GetMessagePos();
todo_wine ok(pos == MAKELONG(320, 340), "pos = %08x\n", pos);
ok(pos == MAKELONG(320, 340), "pos = %08x\n", pos);
SetTimer(button, 1, 250, NULL);
SetCursorPos(330, 350);
......@@ -8041,7 +8041,7 @@ static void test_GetMessagePos(void)
}
ok(msg.message == WM_TIMER, "msg.message = %x\n", msg.message);
pos = GetMessagePos();
todo_wine ok(pos == MAKELONG(330, 350), "pos = %08x\n", pos);
ok(pos == MAKELONG(330, 350), "pos = %08x\n", pos);
KillTimer(button, 1);
DestroyWindow(button);
......
......@@ -263,8 +263,6 @@ typedef struct
struct hardware_msg_data
{
lparam_t info;
int x;
int y;
unsigned int hw_id;
unsigned int flags;
union
......@@ -2934,6 +2932,8 @@ struct get_message_reply
lparam_t wparam;
lparam_t lparam;
int type;
int x;
int y;
unsigned int time;
unsigned int active_hooks;
data_size_t total;
......@@ -5972,6 +5972,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
#define SERVER_PROTOCOL_VERSION 468
#define SERVER_PROTOCOL_VERSION 469
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -279,8 +279,6 @@ typedef struct
struct hardware_msg_data
{
lparam_t info; /* extra info */
int x; /* x position */
int y; /* y position */
unsigned int hw_id; /* unique id */
unsigned int flags; /* hook flags */
union
......@@ -2138,6 +2136,8 @@ enum message_type
lparam_t wparam; /* parameters */
lparam_t lparam; /* parameters */
int type; /* message type */
int x; /* message x position */
int y; /* message y position */
unsigned int time; /* message time */
unsigned int active_hooks; /* active hooks bitmap */
data_size_t total; /* total size of extra data */
......
......@@ -77,6 +77,8 @@ struct message
unsigned int msg; /* message code */
lparam_t wparam; /* parameters */
lparam_t lparam; /* parameters */
int x; /* message position */
int y;
unsigned int time; /* message time */
void *data; /* message data for sent messages */
unsigned int data_size; /* size of message data */
......@@ -352,15 +354,25 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y )
msg->msg = WM_MOUSEMOVE;
msg->wparam = 0;
msg->lparam = 0;
msg->x = x;
msg->y = y;
msg->time = get_tick_count();
msg->result = NULL;
msg->data = msg_data;
msg->data_size = sizeof(*msg_data);
msg_data->x = x;
msg_data->y = y;
queue_hardware_message( desktop, msg, 1 );
}
/* retrieve default position and time for synthesized messages */
static void get_message_defaults( struct msg_queue *queue, int *x, int *y, unsigned int *time )
{
struct desktop *desktop = queue->input->desktop;
*x = desktop->cursor.x;
*y = desktop->cursor.y;
*time = get_tick_count();
}
/* set the cursor clip rectangle */
static void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect )
{
......@@ -506,14 +518,14 @@ static int merge_message( struct thread_input *input, const struct message *msg
/* now we can merge it */
prev->wparam = msg->wparam;
prev->lparam = msg->lparam;
prev->x = msg->x;
prev->y = msg->y;
prev->time = msg->time;
if (msg->type == MSG_HARDWARE && prev->data && msg->data)
{
struct hardware_msg_data *prev_data = prev->data;
struct hardware_msg_data *msg_data = msg->data;
prev_data->x = msg_data->x;
prev_data->y = msg_data->y;
prev_data->info = msg_data->info;
prev_data->info = msg_data->info;
}
list_remove( ptr );
list_add_tail( &input->msg_list, ptr );
......@@ -713,6 +725,8 @@ static void receive_message( struct msg_queue *queue, struct message *msg,
reply->msg = msg->msg;
reply->wparam = msg->wparam;
reply->lparam = msg->lparam;
reply->x = msg->x;
reply->y = msg->y;
reply->time = msg->time;
if (msg->data) set_reply_data_ptr( msg->data, msg->data_size );
......@@ -789,6 +803,8 @@ found:
reply->msg = msg->msg;
reply->wparam = msg->wparam;
reply->lparam = msg->lparam;
reply->x = msg->x;
reply->y = msg->y;
reply->time = msg->time;
if (flags & PM_REMOVE)
......@@ -817,7 +833,8 @@ static int get_quit_message( struct msg_queue *queue, unsigned int flags,
reply->msg = WM_QUIT;
reply->wparam = queue->exit_code;
reply->lparam = 0;
reply->time = get_tick_count();
get_message_defaults( queue, &reply->x, &reply->y, &reply->time );
if (flags & PM_REMOVE)
{
......@@ -1363,7 +1380,6 @@ static user_handle_t find_hardware_message_window( struct desktop *desktop, stru
struct message *msg, unsigned int *msg_code,
struct thread **thread )
{
struct hardware_msg_data *data = msg->data;
user_handle_t win = 0;
*thread = NULL;
......@@ -1383,9 +1399,9 @@ static user_handle_t find_hardware_message_window( struct desktop *desktop, stru
else if (!input || !(win = input->capture)) /* mouse message */
{
if (is_window_visible( msg->win ) && !is_window_transparent( msg->win )) win = msg->win;
else win = shallow_window_from_point( desktop, data->x, data->y );
else win = shallow_window_from_point( desktop, msg->x, msg->y );
*thread = window_thread_from_point( win, data->x, data->y );
*thread = window_thread_from_point( win, msg->x, msg->y );
}
if (!*thread)
......@@ -1434,7 +1450,6 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
struct thread *thread;
struct thread_input *input;
unsigned int msg_code;
struct hardware_msg_data *data = msg->data;
update_input_key_state( desktop, desktop->keystate, msg );
last_input_time = get_tick_count();
......@@ -1451,8 +1466,8 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
{
if (msg->msg == WM_MOUSEMOVE)
{
int x = min( max( data->x, desktop->cursor.clip.left ), desktop->cursor.clip.right-1 );
int y = min( max( data->y, desktop->cursor.clip.top ), desktop->cursor.clip.bottom-1 );
int x = min( max( msg->x, desktop->cursor.clip.left ), desktop->cursor.clip.right-1 );
int y = min( max( msg->y, desktop->cursor.clip.top ), desktop->cursor.clip.bottom-1 );
if (desktop->cursor.x != x || desktop->cursor.y != y) always_queue = 1;
desktop->cursor.x = x;
desktop->cursor.y = y;
......@@ -1466,8 +1481,8 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
if (desktop->keystate[VK_XBUTTON1] & 0x80) msg->wparam |= MK_XBUTTON1;
if (desktop->keystate[VK_XBUTTON2] & 0x80) msg->wparam |= MK_XBUTTON2;
}
data->x = desktop->cursor.x;
data->y = desktop->cursor.y;
msg->x = desktop->cursor.x;
msg->y = desktop->cursor.y;
if (msg->win && (thread = get_window_thread( msg->win )))
{
......@@ -1518,6 +1533,8 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
msg->win = 0;
msg->msg = id;
msg->wparam = hardware_msg->msg;
msg->x = hardware_msg->x;
msg->y = hardware_msg->y;
msg->time = hardware_msg->time;
msg->data_size = hardware_msg->data_size;
msg->result = NULL;
......@@ -1645,12 +1662,12 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
msg->msg = messages[i];
msg->wparam = input->mouse.data << 16;
msg->lparam = 0;
msg->x = x;
msg->y = y;
msg->time = time;
msg->result = NULL;
msg->data = msg_data;
msg->data_size = sizeof(*msg_data);
msg_data->x = x;
msg_data->y = y;
msg_data->info = input->mouse.info;
if (hook_flags & SEND_HWMSG_INJECTED) msg_data->flags = LLMHF_INJECTED;
......@@ -1834,6 +1851,8 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
msg->msg = input->hw.msg;
msg->wparam = 0;
msg->lparam = input->hw.lparam;
msg->x = desktop->cursor.x;
msg->y = desktop->cursor.y;
msg->time = get_tick_count();
msg->result = NULL;
msg->data = msg_data;
......@@ -1956,6 +1975,8 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
reply->msg = msg_code;
reply->wparam = msg->wparam;
reply->lparam = msg->lparam;
reply->x = msg->x;
reply->y = msg->y;
reply->time = msg->time;
data->hw_id = msg->unique_id;
......@@ -2051,11 +2072,12 @@ void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lpa
msg->msg = message;
msg->wparam = wparam;
msg->lparam = lparam;
msg->time = get_tick_count();
msg->result = NULL;
msg->data = NULL;
msg->data_size = 0;
get_message_defaults( thread->queue, &msg->x, &msg->y, &msg->time );
list_add_tail( &thread->queue->msg_list[POST_MESSAGE], &msg->entry );
set_queue_bits( thread->queue, QS_POSTMESSAGE|QS_ALLPOSTMESSAGE );
if (message == WM_HOTKEY)
......@@ -2240,11 +2262,12 @@ DECL_HANDLER(send_message)
msg->msg = req->msg;
msg->wparam = req->wparam;
msg->lparam = req->lparam;
msg->time = get_tick_count();
msg->result = NULL;
msg->data = NULL;
msg->data_size = get_req_data_size();
get_message_defaults( recv_queue, &msg->x, &msg->y, &msg->time );
if (msg->data_size && !(msg->data = memdup( get_req_data(), msg->data_size )))
{
free( msg );
......@@ -2410,7 +2433,7 @@ DECL_HANDLER(get_message)
reply->msg = WM_PAINT;
reply->wparam = 0;
reply->lparam = 0;
reply->time = get_tick_count();
get_message_defaults( queue, &reply->x, &reply->y, &reply->time );
return;
}
......@@ -2424,7 +2447,7 @@ DECL_HANDLER(get_message)
reply->msg = timer->msg;
reply->wparam = timer->id;
reply->lparam = timer->lparam;
reply->time = get_tick_count();
get_message_defaults( queue, &reply->x, &reply->y, &reply->time );
if (!(req->flags & PM_NOYIELD) && current->process->idle_event)
set_event( current->process->idle_event );
return;
......
......@@ -1459,10 +1459,12 @@ C_ASSERT( FIELD_OFFSET(struct get_message_reply, msg) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, wparam) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, lparam) == 24 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, type) == 32 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, time) == 36 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, active_hooks) == 40 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, total) == 44 );
C_ASSERT( sizeof(struct get_message_reply) == 48 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, x) == 36 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, y) == 40 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, time) == 44 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, active_hooks) == 48 );
C_ASSERT( FIELD_OFFSET(struct get_message_reply, total) == 52 );
C_ASSERT( sizeof(struct get_message_reply) == 56 );
C_ASSERT( FIELD_OFFSET(struct reply_message_request, remove) == 12 );
C_ASSERT( FIELD_OFFSET(struct reply_message_request, result) == 16 );
C_ASSERT( sizeof(struct reply_message_request) == 24 );
......
......@@ -2618,6 +2618,8 @@ static void dump_get_message_reply( const struct get_message_reply *req )
dump_uint64( ", wparam=", &req->wparam );
dump_uint64( ", lparam=", &req->lparam );
fprintf( stderr, ", type=%d", req->type );
fprintf( stderr, ", x=%d", req->x );
fprintf( stderr, ", y=%d", req->y );
fprintf( stderr, ", time=%08x", req->time );
fprintf( stderr, ", active_hooks=%08x", req->active_hooks );
fprintf( stderr, ", total=%u", req->total );
......
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