From: Damjan Jovanovic Subject: winex11.drv: translate the WM_DROPFILES point into client coordinates whenever possible Message-Id: Date: Sun, 22 Jun 2014 12:33:59 +0200 Notepad++ ignores the return value of DragQueryPoint() which determines whether the point is in client area coordinates or global screen coordinates, and passes the returned point directly to RealChildWindowFromPoint(), which means that on Windows the WM_DROPFILES point must be in client coordinates. Translating the point into client coodinates fixes dropping files into Notepad++ and closes #28557. Damjan Jovanovic --- dlls/winex11.drv/xdnd.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c index 3390dad..f320be2 100644 --- a/dlls/winex11.drv/xdnd.c +++ b/dlls/winex11.drv/xdnd.c @@ -566,11 +566,21 @@ static void X11DRV_XDND_SendDropFiles(HWND hwnd) if (dropHandle) { DROPFILES *lpDrop = GlobalLock(dropHandle); + memcpy(lpDrop, GlobalLock(current->contents), GlobalSize(current->contents)); + GlobalUnlock(current->contents); lpDrop->pt.x = XDNDxy.x; lpDrop->pt.y = XDNDxy.y; - memcpy(lpDrop, GlobalLock(current->contents), GlobalSize(current->contents)); - TRACE("Sending WM_DROPFILES: hWnd(0x%p) %p(%s)\n", hwnd, - ((char*)lpDrop) + lpDrop->pFiles, debugstr_w((WCHAR*)(((char*)lpDrop) + lpDrop->pFiles))); + if (ScreenToClient(hwnd, &lpDrop->pt)) + lpDrop->fNC = FALSE; + else + { + lpDrop->fNC = TRUE; + lpDrop->pt.x = XDNDxy.x; + lpDrop->pt.y = XDNDxy.y; + } + TRACE("Sending WM_DROPFILES: hWnd=0x%p, fNC=%d, x=%d, y=%d, files=%p(%s)\n", hwnd, lpDrop->fNC, + lpDrop->pt.x, lpDrop->pt.y, + ((char*)lpDrop) + lpDrop->pFiles, debugstr_w((WCHAR*)(((char*)lpDrop) + lpDrop->pFiles))); GlobalUnlock(dropHandle); if (!PostMessageW(hwnd, WM_DROPFILES, (WPARAM)dropHandle, 0))