[PATCH] winex11: The correct way to search the target window for drag&drop operations.

John Found johnfound at asm32.info
Thu Apr 18 11:39:46 CDT 2019


On Thu, 18 Apr 2019 09:47:17 -0500
Zebediah Figura <z.figura12 at gmail.com> wrote:

> On 4/18/19 6:37 AM, John Found wrote:
> >> I don't think that's correct; the documentation states that
> >> WindowFromPoint() returns the deepest child, and we have tests to
> >> support this.
> >>
> > 
> > What documentation? MS documentation is pretty vague:
> > 
> > https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-windowfrompoint
> > 
> > It states only that: "Retrieves a handle to the window that contains the specified point." >
> > In addition, the current implementation of drop target detection code uses exactly WindowFromPoint
> > (see the patch - I have replaced this line) and it definitely does not detects the children windows at all.
> > 
> > I will attach a small test application that creates a parent window and 3 nested children, all of them has WS_EX_ACCEPTFILES set.
> > 
> > When you drop a file at some of the windows (the parent or some of the children) the static control displays what is
> > the drop operation target.
> > 
> > So, in Linux, only the "Parent" is returned, regardless of the real drop target. In Windows and in Linux with the
> > applied patch, the drop target is always the right child window.
> > 
> > 
> Er, yes, that was my mistake, sorry. MSDN is not clear at all. However, 
> the point remains, we have tests for this behaviour, and as far as I'm 
> reading the server code it should be implemented correctly. If it's not 
> working, then I would guess there's a bug elsewhere (or possibly there's 
> some quirk here that the tests don't cover, but then we should find and 
> identify that first.)
> 
> 
Well, I don't know. I always expected that WindowFromPoint will return the top level window. And GetChildWindowFromPointEx will return only the children from the first level. Both in Windows and in WINE.  

BTW, MSDN for ChildWindowFromPointEx says: "Determines which, if any, of the child windows belonging to the specified parent window contains the specified point. The function can ignore invisible, disabled, and transparent child windows. The search is restricted to immediate child windows. **Grandchildren and deeper descendants are not searched.**"

So, IMHO you are wrong and the implementation in WINE is correct. And the tests that pass are probably not for the
children from the upper levels.

-- 
John Found <johnfound at asm32.info>



More information about the wine-devel mailing list