From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/message.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index d1f49ca3ed9..8e1b0d7bbae 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2404,12 +2404,12 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H static MSG clk_msg;
POINT pt; - UINT message; + UINT message, context; INT hittest; EVENTMSG event; GUITHREADINFO info; MOUSEHOOKSTRUCTEX hook; - BOOL eat_msg; + BOOL eat_msg = TRUE; WPARAM wparam;
/* find the window to dispatch this mouse message to */ @@ -2443,7 +2443,7 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H }
msg->pt = point_phys_to_win_dpi( msg->hwnd, msg->pt ); - set_thread_dpi_awareness_context( get_window_dpi_awareness_context( msg->hwnd )); + context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( msg->hwnd ) );
/* FIXME: is this really the right place for this hook? */ event.message = msg->message; @@ -2453,7 +2453,7 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H event.paramH = msg->pt.y; call_hooks( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&event, sizeof(event) );
- if (!check_hwnd_filter( msg, hwnd_filter )) return FALSE; + if (!check_hwnd_filter( msg, hwnd_filter )) goto done;
pt = msg->pt; message = msg->message; @@ -2508,13 +2508,13 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H } } } - if (message < first || message > last) return FALSE; + if (message < first || message > last) goto done; /* update static double click conditions */ if (update) clk_msg = *msg; } else { - if (message < first || message > last) return FALSE; + if (message < first || message > last) goto done; } msg->wParam = wparam;
@@ -2534,26 +2534,26 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H hook.mouseData = msg->wParam; accept_hardware_message( hw_id ); call_hooks( WH_CBT, HCBT_CLICKSKIPPED, message, (LPARAM)&hook, sizeof(hook) ); - return FALSE; + goto done; }
if ((hittest == HTERROR) || (hittest == HTNOWHERE)) { send_message( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd, MAKELONG( hittest, msg->message )); accept_hardware_message( hw_id ); - return FALSE; + goto done; }
if (remove) accept_hardware_message( hw_id );
+ eat_msg = FALSE; + if (!remove || info.hwndCapture) { msg->message = message; - return TRUE; + goto done; }
- eat_msg = FALSE; - if (msg->message == WM_LBUTTONDOWN || msg->message == WM_RBUTTONDOWN || msg->message == WM_MBUTTONDOWN || @@ -2604,6 +2604,9 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H send_message( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd, MAKELONG( hittest, msg->message ));
msg->message = message; + +done: + set_thread_dpi_awareness_context( context ); return !eat_msg; }