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

Zebediah Figura z.figura12 at gmail.com
Thu Apr 18 00:34:16 CDT 2019


On 4/18/19 12:30 AM, John Found wrote:
> On Wed, 17 Apr 2019 18:30:11 -0500
> Zebediah Figura <z.figura12 at gmail.com> wrote:
> 
>> Hello John, thanks for the patch! Note that all patches require a
>> Signed-off-by header, as a way of taking responsibility for the patch
>> and acknowledging that you believe it's acceptable for Wine.
>>
> Hello Zebediah. I though it is needed only if I am posting a patch written by someone else.
> But yes, I beleave, that this patch is acceptable and Wine. That is why I am sending it here.
> 
> Should I resend the patch again now, with this header?

Yes, please do so.

>> On 4/17/19 4:20 PM, John Found wrote:
>>   > +/* the recursive worker for window_from_point_dnd */
>>   > +HWND do_window_from_point_dnd(HWND hwnd, POINT* point)
>>   > +{
>>   > +    HWND w;
>>   > +    w = ChildWindowFromPointEx(hwnd, *point, CWP_SKIPDISABLED |
>> CWP_SKIPINVISIBLE);
>>   > +    if (w && (w != hwnd))
>>   > +    {
>>   > +        MapWindowPoints(hwnd, w, point, 1);
>>   > +        w = do_window_from_point_dnd(w, point);
>>   > +    }
>>   > +    return w;
>>   > +}
>>   > +
>>   > +
>>   > +/* Recursively search for the window on given coordinates in a
>> drag&drop specific manner. */
>>   > +HWND window_from_point_dnd(HWND hwnd, POINT point)
>>   > +{
>>   > +    POINT p;
>>   > +    p.x = point.x;
>>   > +    p.y = point.y;
>>   > +    ScreenToClient(hwnd, &p);
>>   > +    return do_window_from_point_dnd(hwnd, &p);
>>   > +}
>>   > +
>>
>> Maybe I'm missing something here, but don't these two functions
>> effectively do the equivalent of WindowFromPoint(point)? Is there any
>> reason we can't just use that instead?
>>
>>
> WindowFromPoint, ChildWindowFromPointEx and other similar functions return only the top level windows
> or the immediate children of them. While the drop target can be somewhere deeper in the window tree.
> This is exactly why the behavior of drag&drop operations in Wine for Linux is different from the original Windows.
> 

I don't think that's correct; the documentation states that 
WindowFromPoint() returns the deepest child, and we have tests to 
support this.

> The function "do_window_from_point_dnd" searches recursively down the windows tree and returns the most deeper child that
> contains the point. Then it searches back up, until a window with WS_EX_ACCEPTFILES is found. (or not, of course).
> 
> 



More information about the wine-devel mailing list