On Thu, 18 Apr 2019 00:34:16 -0500 Zebediah Figura z.figura12@gmail.com wrote:
On 4/18/19 12:30 AM, John Found wrote:
On Wed, 17 Apr 2019 18:30:11 -0500 Zebediah Figura z.figura12@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.
Do I need to label the patch as v2 or it is enough to email it the same way, only with "Signed-off-by" header added?
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.
What documentation? MS documentation is pretty vague:
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-wind...
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.
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).