Module: wine Branch: master Commit: 0d9ce8a02502981fdbb7fd7a772e719b67f03d2c URL: https://source.winehq.org/git/wine.git/?a=commit;h=0d9ce8a02502981fdbb7fd7a7...
Author: Huw Davies huw@codeweavers.com Date: Tue Feb 6 10:08:25 2018 +0000
user32: Add a heuristic to find the mouse message's window.
This can't be done properly without support from the native windowing system. However, it's a good bet to try the next window in the z-order if it's the owner of the original window and it's in the same thread.
Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/user32/message.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 172d659..6b7f918 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -2502,7 +2502,16 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H } else { + HWND orig = msg->hwnd; + msg->hwnd = WINPOS_WindowFromPoint( msg->hwnd, msg->pt, &hittest ); + if (!msg->hwnd) /* As a heuristic, try the next window if it's the owner of orig */ + { + HWND next = GetWindow( orig, GW_HWNDNEXT ); + + if (next && GetWindow( orig, GW_OWNER ) == next && WIN_IsCurrentThread( next )) + msg->hwnd = WINPOS_WindowFromPoint( next, msg->pt, &hittest ); + } }
if (!msg->hwnd || !WIN_IsCurrentThread( msg->hwnd ))