Rebase against f9741837a3bff3a912442695b4f7c3f5efbef557.

This commit is contained in:
Alistair Leslie-Hughes
2025-05-09 13:30:18 +10:00
parent abf4b4db07
commit 86a7c93cdd
5 changed files with 82 additions and 90 deletions

View File

@@ -1,4 +1,4 @@
From 1569189e4213b5df68680c56e18f397873bc19aa Mon Sep 17 00:00:00 2001
From 31eece6eff95baed8c1d9404d2cfc05834df9753 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 15 Mar 2015 01:05:48 +0100
Subject: [PATCH] server: Fix handling of GetMessage after previous PeekMessage
@@ -15,10 +15,10 @@ Changes in v3:
2 files changed, 65 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 9282896262e..d4749a1eb57 100644
index a5f7318dffd..e50ddc45038 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -14478,13 +14478,10 @@ static void test_PeekMessage3(void)
@@ -14569,13 +14569,10 @@ static void test_PeekMessage3(void)
ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = PeekMessageA(&msg, hwnd, 0, 0, PM_NOREMOVE);
@@ -32,7 +32,7 @@ index 9282896262e..d4749a1eb57 100644
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = PeekMessageA(&msg, hwnd, 0, 0, 0);
ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret);
@@ -14494,10 +14491,8 @@ static void test_PeekMessage3(void)
@@ -14585,10 +14582,8 @@ static void test_PeekMessage3(void)
ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE);
@@ -43,7 +43,7 @@ index 9282896262e..d4749a1eb57 100644
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = PeekMessageA(&msg, hwnd, 0, 0, 0);
ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret);
@@ -14509,10 +14504,11 @@ static void test_PeekMessage3(void)
@@ -14600,10 +14595,11 @@ static void test_PeekMessage3(void)
ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = GetMessageA(&msg, hwnd, 0, 0);
@@ -57,7 +57,7 @@ index 9282896262e..d4749a1eb57 100644
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = PeekMessageA(&msg, hwnd, 0, 0, 0);
ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret);
@@ -14540,14 +14536,32 @@ static void test_PeekMessage3(void)
@@ -14631,14 +14627,32 @@ static void test_PeekMessage3(void)
ret = GetMessageA(&msg, hwnd, 0, 0);
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = GetMessageA(&msg, hwnd, 0, 0);
@@ -93,18 +93,18 @@ index 9282896262e..d4749a1eb57 100644
* because both messages are in the same queue. */
diff --git a/server/queue.c b/server/queue.c
index 520659d377c..2d23fb0def8 100644
index cfbc9e6c89b..f07b73e3ce9 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -133,6 +133,7 @@ struct msg_queue
@@ -134,6 +134,7 @@ struct msg_queue
timeout_t last_get_msg; /* time of last get message call */
int keystate_lock; /* owns an input keystate lock */
const queue_shm_t *shared; /* queue in session shared memory */
queue_shm_t *shared; /* queue in session shared memory */
+ unsigned int ignore_post_msg; /* ignore post messages newer than this unique id */
};
struct hotkey
@@ -312,6 +313,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
@@ -313,6 +314,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
queue->hooks = NULL;
queue->last_get_msg = current_time;
queue->keystate_lock = 0;
@@ -112,7 +112,7 @@ index 520659d377c..2d23fb0def8 100644
list_init( &queue->send_result );
list_init( &queue->callback_result );
list_init( &queue->pending_timers );
@@ -792,13 +794,21 @@ static inline struct msg_queue *get_current_queue(void)
@@ -793,13 +795,21 @@ static inline struct msg_queue *get_current_queue(void)
}
/* get a (pseudo-)unique id to tag hardware messages */
@@ -135,7 +135,7 @@ index 520659d377c..2d23fb0def8 100644
/* lookup an already queued mouse message that matches the message, window and type */
static struct message *find_mouse_message( struct thread_input *input, const struct message *msg )
{
@@ -1144,7 +1154,7 @@ static int match_window( user_handle_t win, user_handle_t msg_win )
@@ -1150,7 +1160,7 @@ static int match_window( user_handle_t win, user_handle_t msg_win )
}
/* retrieve a posted message */
@@ -144,7 +144,7 @@ index 520659d377c..2d23fb0def8 100644
unsigned int first, unsigned int last, unsigned int flags,
struct get_message_reply *reply )
{
@@ -1155,6 +1165,7 @@ static int get_posted_message( struct msg_queue *queue, user_handle_t win,
@@ -1161,6 +1171,7 @@ static int get_posted_message( struct msg_queue *queue, user_handle_t win,
{
if (!match_window( win, msg->win )) continue;
if (!check_msg_filter( msg->msg, first, last )) continue;
@@ -152,7 +152,7 @@ index 520659d377c..2d23fb0def8 100644
goto found; /* found one */
}
return 0;
@@ -1835,6 +1846,7 @@ found:
@@ -1841,6 +1852,7 @@ found:
msg->msg = WM_HOTKEY;
msg->wparam = hotkey->id;
msg->lparam = ((hotkey->vkey & 0xffff) << 16) | modifiers;
@@ -160,7 +160,7 @@ index 520659d377c..2d23fb0def8 100644
free( msg->data );
msg->data = NULL;
@@ -2821,7 +2833,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
@@ -2827,7 +2839,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
}
/* now we can return it */
@@ -169,7 +169,7 @@ index 520659d377c..2d23fb0def8 100644
reply->type = MSG_HARDWARE;
reply->win = win;
reply->msg = msg_code;
@@ -2928,6 +2940,7 @@ void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lpa
@@ -2934,6 +2946,7 @@ void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lpa
msg->result = NULL;
msg->data = NULL;
msg->data_size = 0;
@@ -177,7 +177,7 @@ index 520659d377c..2d23fb0def8 100644
get_message_defaults( thread->queue, &msg->x, &msg->y, &msg->time );
@@ -3245,6 +3258,7 @@ DECL_HANDLER(send_message)
@@ -3251,6 +3264,7 @@ DECL_HANDLER(send_message)
set_queue_bits( recv_queue, QS_SENDMESSAGE );
break;
case MSG_POSTED:
@@ -185,7 +185,7 @@ index 520659d377c..2d23fb0def8 100644
list_add_tail( &recv_queue->msg_list[POST_MESSAGE], &msg->entry );
set_queue_bits( recv_queue, QS_POSTMESSAGE|QS_ALLPOSTMESSAGE );
if (msg->msg == WM_HOTKEY)
@@ -3379,12 +3393,12 @@ DECL_HANDLER(get_message)
@@ -3385,12 +3399,12 @@ DECL_HANDLER(get_message)
/* then check for posted messages */
if ((filter & QS_POSTMESSAGE) &&
@@ -200,7 +200,7 @@ index 520659d377c..2d23fb0def8 100644
return;
/* only check for quit messages if not posted messages pending */
@@ -3395,7 +3409,7 @@ DECL_HANDLER(get_message)
@@ -3401,7 +3415,7 @@ DECL_HANDLER(get_message)
if ((filter & QS_INPUT) &&
filter_contains_hw_range( req->get_first, req->get_last ) &&
get_hardware_message( current, req->hw_id, get_win, req->get_first, req->get_last, req->flags, reply ))
@@ -209,7 +209,7 @@ index 520659d377c..2d23fb0def8 100644
/* now check for WM_PAINT */
if ((filter & QS_PAINT) &&
@@ -3408,7 +3422,7 @@ DECL_HANDLER(get_message)
@@ -3414,7 +3428,7 @@ DECL_HANDLER(get_message)
reply->wparam = 0;
reply->lparam = 0;
get_message_defaults( queue, &reply->x, &reply->y, &reply->time );
@@ -218,7 +218,7 @@ index 520659d377c..2d23fb0def8 100644
}
/* now check for timer */
@@ -3424,9 +3438,19 @@ DECL_HANDLER(get_message)
@@ -3430,9 +3444,19 @@ DECL_HANDLER(get_message)
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 );
@@ -239,7 +239,7 @@ index 520659d377c..2d23fb0def8 100644
if (get_win == -1 && current->process->idle_event) set_event( current->process->idle_event );
SHARED_WRITE_BEGIN( queue_shm, queue_shm_t )
@@ -3437,6 +3461,13 @@ DECL_HANDLER(get_message)
@@ -3443,6 +3467,13 @@ DECL_HANDLER(get_message)
SHARED_WRITE_END;
set_error( STATUS_PENDING ); /* FIXME */
@@ -253,7 +253,7 @@ index 520659d377c..2d23fb0def8 100644
}
@@ -3454,7 +3485,10 @@ DECL_HANDLER(reply_message)
@@ -3460,7 +3491,10 @@ DECL_HANDLER(reply_message)
DECL_HANDLER(accept_hardware_message)
{
if (current->queue)