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; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/input.c | 8 ++++++-- dlls/win32u/message.c | 4 ++-- dlls/win32u/win32u_private.h | 2 +- dlls/win32u/window.c | 13 ++++++++----- 4 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 5b25086cb6f..5e42b2dc63a 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1603,11 +1603,13 @@ void update_mouse_tracking_info( HWND hwnd ) { int hover_width = 0, hover_height = 0, hittest; POINT pos; + UINT dpi;
TRACE( "hwnd %p\n", hwnd );
get_cursor_pos( &pos ); - hwnd = window_from_point( hwnd, pos, &hittest ); + if (!(dpi = get_thread_dpi())) dpi = get_win_monitor_dpi( hwnd ); + hwnd = window_from_point( hwnd, pos, &hittest, get_thread_dpi() );
TRACE( "point %s hwnd %p hittest %d\n", wine_dbgstr_point(&pos), hwnd, hittest );
@@ -1673,6 +1675,7 @@ BOOL WINAPI NtUserTrackMouseEvent( TRACKMOUSEEVENT *info ) int hittest; HWND hwnd; POINT pos; + UINT dpi;
TRACE( "size %u, flags %#x, hwnd %p, time %u\n", (int)info->cbSize, (int)info->dwFlags, info->hwndTrack, (int)info->dwHoverTime ); @@ -1703,7 +1706,8 @@ BOOL WINAPI NtUserTrackMouseEvent( TRACKMOUSEEVENT *info ) NtUserSystemParametersInfo( SPI_GETMOUSEHOVERTIME, 0, &hover_time, 0 );
get_cursor_pos( &pos ); - hwnd = window_from_point( info->hwndTrack, pos, &hittest ); + if (!(dpi = get_thread_dpi())) dpi = get_win_monitor_dpi( info->hwndTrack ); + hwnd = window_from_point( info->hwndTrack, pos, &hittest, dpi ); TRACE( "point %s hwnd %p hittest %d\n", wine_dbgstr_point(&pos), hwnd, hittest );
if (info->dwFlags & ~(TME_CANCEL | TME_HOVER | TME_LEAVE | TME_NONCLIENT)) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 8e1b0d7bbae..f73800f101e 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2425,14 +2425,14 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H { HWND orig = msg->hwnd;
- msg->hwnd = window_from_point( msg->hwnd, msg->pt, &hittest ); + msg->hwnd = window_from_point( msg->hwnd, msg->pt, &hittest, get_win_monitor_dpi( msg->hwnd ) ); if (!msg->hwnd) /* As a heuristic, try the next window if it's the owner of orig */ { HWND next = get_window_relative( orig, GW_HWNDNEXT );
if (next && get_window_relative( orig, GW_OWNER ) == next && is_current_thread_window( next )) - msg->hwnd = window_from_point( next, msg->pt, &hittest ); + msg->hwnd = window_from_point( next, msg->pt, &hittest, get_win_monitor_dpi( next ) ); } }
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 96517ef081a..8e33370ee48 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -252,7 +252,7 @@ extern BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ); extern ULONG set_window_style( HWND hwnd, ULONG set_bits, ULONG clear_bits ); extern BOOL show_owned_popups( HWND owner, BOOL show ); extern void update_window_state( HWND hwnd ); -extern HWND window_from_point( HWND hwnd, POINT pt, INT *hittest ); +extern HWND window_from_point( HWND hwnd, POINT pt, INT *hittest, UINT dpi ); extern HWND get_shell_window(void); extern HWND get_progman_window(void); extern HWND set_progman_window( HWND hwnd ); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 8ca49afcd87..a3d92066aa8 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2239,19 +2239,18 @@ static HWND *list_children_from_point( HWND hwnd, POINT pt ) * * Find the window and hittest for a given point. */ -HWND window_from_point( HWND hwnd, POINT pt, INT *hittest ) +HWND window_from_point( HWND hwnd, POINT pt, INT *hittest, UINT dpi ) { int i, res; HWND ret, *list; POINT win_pt; - int dpi;
if (!hwnd) hwnd = get_desktop_window(); - if (!(dpi = get_thread_dpi())) dpi = get_win_monitor_dpi( hwnd );
*hittest = HTNOWHERE;
- if (!(list = list_children_from_point( hwnd, pt ))) return 0; + win_pt = map_dpi_point( pt, dpi, get_dpi_for_window( hwnd ) ); + if (!(list = list_children_from_point( hwnd, win_pt ))) return 0;
/* now determine the hittest */
@@ -2291,9 +2290,13 @@ HWND window_from_point( HWND hwnd, POINT pt, INT *hittest ) */ HWND WINAPI NtUserWindowFromPoint( LONG x, LONG y ) { + HWND hwnd = get_desktop_window(); POINT pt = { .x = x, .y = y }; INT hittest; - return window_from_point( 0, pt, &hittest ); + UINT dpi; + + if (!(dpi = get_thread_dpi())) dpi = get_win_monitor_dpi( hwnd ); + return window_from_point( hwnd, pt, &hittest, dpi ); }
/*******************************************************************
This isn't right sorry, I'll make another one.
This merge request was closed by Rémi Bernon.