[PATCH 5/6] user32: Add discard_internal parameter to peek_message.
Rémi Bernon
rbernon at codeweavers.com
Mon Apr 27 02:06:25 CDT 2020
This will allow us to discard internal messages without processing them.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/user32/message.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 0f55f6ad1b3b..118522ea4722 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -2747,7 +2747,8 @@ static inline void call_sendmsg_callback( SENDASYNCPROC callback, HWND hwnd, UIN
* available; -1 on error.
* All pending sent messages are processed before returning.
*/
-static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, UINT changed_mask )
+static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
+ UINT changed_mask, BOOL discard_internal )
{
LRESULT result;
struct user_thread_info *thread_info = get_user_thread_info();
@@ -2816,6 +2817,9 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
continue;
}
+ if (discard_internal && (info.msg.message & 0x80000000))
+ continue;
+
TRACE( "got type %d msg %x (%s) hwnd %p wp %lx lp %lx\n",
info.type, info.msg.message,
(info.type == MSG_WINEVENT) ? "MSG_WINEVENT" : SPY_GetMsgName(info.msg.message, info.msg.hwnd),
@@ -2955,7 +2959,8 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
}
else
peek_message( msg, info.msg.hwnd, info.msg.message,
- info.msg.message, flags | PM_REMOVE, changed_mask );
+ info.msg.message, flags | PM_REMOVE, changed_mask,
+ discard_internal );
continue;
}
if (info.msg.message >= WM_DDE_FIRST && info.msg.message <= WM_DDE_LAST)
@@ -2999,7 +3004,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
static inline void process_sent_messages(void)
{
MSG msg;
- peek_message( &msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE, 0 );
+ peek_message( &msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE, 0, FALSE );
}
@@ -3800,7 +3805,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW( MSG *msg_out, HWND hwnd, UINT first,
USER_CheckNotLock();
check_for_driver_events( 0 );
- ret = peek_message( &msg, hwnd, first, last, flags, 0 );
+ ret = peek_message( &msg, hwnd, first, last, flags, 0, FALSE );
if (ret < 0) return FALSE;
if (!ret)
@@ -3808,7 +3813,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW( MSG *msg_out, HWND hwnd, UINT first,
flush_window_surfaces( TRUE );
ret = wow_handlers.wait_message( 0, NULL, 0, QS_ALLINPUT, 0 );
/* if we received driver events, check again for a pending message */
- if (ret == WAIT_TIMEOUT || peek_message( &msg, hwnd, first, last, flags, 0 ) <= 0) return FALSE;
+ if (ret == WAIT_TIMEOUT || peek_message( &msg, hwnd, first, last, flags, 0, FALSE ) <= 0)
+ return FALSE;
}
check_for_driver_events( msg.message );
@@ -3862,7 +3868,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT
}
else mask = QS_ALLINPUT;
- while (!(ret = peek_message( msg, hwnd, first, last, PM_REMOVE | (mask << 16), mask )))
+ while (!(ret = peek_message( msg, hwnd, first, last, PM_REMOVE | (mask << 16), mask, FALSE )))
{
wait_objects( 1, &server_queue, INFINITE, mask & (QS_SENDMESSAGE | QS_SMRESULT), mask, 0 );
}
--
2.26.1
More information about the wine-devel
mailing list