Rebase against 8da914b27c9939ecf511001bcac1a6c74e7edde0.

This commit is contained in:
Elizabeth Figura
2025-09-21 16:54:15 -05:00
parent 64988e15df
commit 20ba4773d6
5 changed files with 31 additions and 225 deletions

View File

@@ -1,4 +1,4 @@
From da9b85d2993598eb6153d5e1610ba327284715a6 Mon Sep 17 00:00:00 2001
From 623d7db7b7e909c2c2dfd40acc454e8c344bd7f1 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 a5f7318dffd..e50ddc45038 100644
index c8a12a6f998..618eba3419a 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -14569,13 +14569,10 @@ static void test_PeekMessage3(void)
@@ -14609,13 +14609,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 a5f7318dffd..e50ddc45038 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);
@@ -14585,10 +14582,8 @@ static void test_PeekMessage3(void)
@@ -14625,10 +14622,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 a5f7318dffd..e50ddc45038 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);
@@ -14600,10 +14595,11 @@ static void test_PeekMessage3(void)
@@ -14640,10 +14635,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 a5f7318dffd..e50ddc45038 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);
@@ -14631,14 +14627,32 @@ static void test_PeekMessage3(void)
@@ -14671,14 +14667,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,7 +93,7 @@ index a5f7318dffd..e50ddc45038 100644
* because both messages are in the same queue. */
diff --git a/server/queue.c b/server/queue.c
index 3845a86c962..ed5ebf6996e 100644
index 3f06c15d006..46c52c32d24 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -136,6 +136,7 @@ struct msg_queue
@@ -104,15 +104,15 @@ index 3845a86c962..ed5ebf6996e 100644
};
struct hotkey
@@ -318,6 +319,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
@@ -319,6 +320,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
queue->input = (struct thread_input *)grab_object( input );
queue->hooks = NULL;
queue->last_get_msg = current_time;
queue->keystate_lock = 0;
+ queue->ignore_post_msg = 0;
queue->waiting = 0;
list_init( &queue->send_result );
list_init( &queue->callback_result );
@@ -812,13 +814,21 @@ static inline struct msg_queue *get_current_queue(void)
@@ -818,13 +820,21 @@ static inline struct msg_queue *get_current_queue(void)
}
/* get a (pseudo-)unique id to tag hardware messages */
@@ -135,7 +135,7 @@ index 3845a86c962..ed5ebf6996e 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 )
{
@@ -1169,7 +1179,7 @@ static int match_window( user_handle_t win, user_handle_t msg_win )
@@ -1175,7 +1185,7 @@ static int match_window( user_handle_t win, user_handle_t msg_win )
}
/* retrieve a posted message */
@@ -144,7 +144,7 @@ index 3845a86c962..ed5ebf6996e 100644
unsigned int first, unsigned int last, unsigned int flags,
struct get_message_reply *reply )
{
@@ -1180,6 +1190,7 @@ static int get_posted_message( struct msg_queue *queue, user_handle_t win,
@@ -1186,6 +1196,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;
@@ -177,7 +177,7 @@ index 3845a86c962..ed5ebf6996e 100644
get_message_defaults( thread->queue, &msg->x, &msg->y, &msg->time );
@@ -3259,6 +3272,7 @@ DECL_HANDLER(send_message)
@@ -3254,6 +3267,7 @@ DECL_HANDLER(send_message)
set_queue_bits( recv_queue, QS_SENDMESSAGE );
break;
case MSG_POSTED:
@@ -185,7 +185,7 @@ index 3845a86c962..ed5ebf6996e 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)
@@ -3395,12 +3409,12 @@ DECL_HANDLER(get_message)
@@ -3394,12 +3408,12 @@ DECL_HANDLER(get_message)
/* then check for posted messages */
if ((filter & QS_POSTMESSAGE) &&
@@ -200,7 +200,7 @@ index 3845a86c962..ed5ebf6996e 100644
return;
/* only check for quit messages if not posted messages pending */
@@ -3411,7 +3425,7 @@ DECL_HANDLER(get_message)
@@ -3410,7 +3424,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 3845a86c962..ed5ebf6996e 100644
/* now check for WM_PAINT */
if ((filter & QS_PAINT) &&
@@ -3424,7 +3438,7 @@ DECL_HANDLER(get_message)
@@ -3423,7 +3437,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 3845a86c962..ed5ebf6996e 100644
}
/* now check for timer */
@@ -3440,9 +3454,19 @@ DECL_HANDLER(get_message)
@@ -3439,9 +3453,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 3845a86c962..ed5ebf6996e 100644
if (get_win == -1 && current->process->idle_event) set_event( current->process->idle_event );
SHARED_WRITE_BEGIN( queue_shm, queue_shm_t )
@@ -3454,6 +3478,13 @@ DECL_HANDLER(get_message)
@@ -3453,6 +3477,13 @@ DECL_HANDLER(get_message)
reset_queue_sync( queue );
set_error( STATUS_PENDING ); /* FIXME */
@@ -253,7 +253,7 @@ index 3845a86c962..ed5ebf6996e 100644
}
@@ -3471,7 +3502,10 @@ DECL_HANDLER(reply_message)
@@ -3470,7 +3501,10 @@ DECL_HANDLER(reply_message)
DECL_HANDLER(accept_hardware_message)
{
if (current->queue)
@@ -265,5 +265,5 @@ index 3845a86c962..ed5ebf6996e 100644
set_error( STATUS_ACCESS_DENIED );
}
--
2.47.2
2.50.1