From a1859fe2d5b863e359aef3540b083761fcfb1fcd Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Mon, 28 Mar 2005 07:45:42 +0000 Subject: [PATCH] Fix locating window at point for DnD git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@20984 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 4 ++++ Source/win32/WIN32Server.m | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e32b852..dbe284f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-03-28 Richard Frith-Macdonald + + * Source/win32/WIN32Server.m: fix for locating window at point. + 2005-03-21 Adam Fedor * Source/art/blit.m (artcontext_setup_draw_info): Add mail address diff --git a/Source/win32/WIN32Server.m b/Source/win32/WIN32Server.m index 072dcb4..48c36e9 100644 --- a/Source/win32/WIN32Server.m +++ b/Source/win32/WIN32Server.m @@ -186,10 +186,26 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, hwnd = WindowFromPoint(p); if ((int)hwnd == win) { - hwnd = GetWindow(hwnd, GW_HWNDNEXT); + /* + * If the winodw at the point we want is excluded, + * we must look through ALL windows at a lower level + * until we find one which contains the same point. + */ + while (hwnd != 0) + { + RECT r; + + hwnd = GetWindow(hwnd, GW_HWNDNEXT); + GetWindowRect(hwnd, &r); + if (PtInRect(&r, p)) + { + break; + } + } } - *windowRef = (int)hwnd; + *windowRef = (int)hwnd; // Any windows + return (int)hwnd; }