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 ); }
/*******************************************************************