John Found johnfound@asm32.info writes:
+HWND do_window_from_point_dnd(HWND hwnd, POINT* point) +{
- HWND w;
- w = ChildWindowFromPointEx(hwnd, *point, CWP_SKIPDISABLED | CWP_SKIPINVISIBLE);
- if (w && (w != hwnd))
- {
ClientToScreen(hwnd, point);
ScreenToClient(w, point);
MapWindowPoints() would be more efficient.
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);
+}
There's no need to make it recursive.
@@ -423,10 +455,20 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event ) { /* Only send WM_DROPFILES if Drop didn't succeed or DROPEFFECT_NONE was set. * Doing both causes winamp to duplicate the dropped files (#29081) */
if ((GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES) &&
X11DRV_XDND_HasHDROP())
POINT pt;
HWND hwnd_drop;
pt.x = XDNDxy.x;
pt.y = XDNDxy.y;
hwnd_drop = window_from_point_dnd(hWnd, pt);
while (hwnd_drop && !(GetWindowLongW(hwnd_drop, GWL_EXSTYLE) & WS_EX_ACCEPTFILES))
hwnd_drop = GetParent(hwnd_drop);
if (hwnd_drop)
You are losing the X11DRV_XDND_HasHDROP() check. If that's deliberate, it should be a separate patch.