diff --git a/dlls/user/user32.spec b/dlls/user/user32.spec index e00df5a4c2..23e8d4c1ae 100644 --- a/dlls/user/user32.spec +++ b/dlls/user/user32.spec @@ -688,7 +688,6 @@ init UserClientDllInitialize @ cdecl CLIPBOARD_LookupFormat(long) CLIPBOARD_LookupFormat @ cdecl CLIPBOARD_ReleaseOwner() CLIPBOARD_ReleaseOwner @ cdecl DCE_InvalidateDCE(long ptr) DCE_InvalidateDCE -@ cdecl DRAG_QueryUpdate(long long long) DRAG_QueryUpdate @ cdecl HOOK_CallHooksA(long long long long) HOOK_CallHooksA @ cdecl HOOK_CallHooksW(long long long long) HOOK_CallHooksW @ cdecl HOOK_IsHooked(long) HOOK_IsHooked diff --git a/dlls/x11drv/event.c b/dlls/x11drv/event.c index 2776e2b235..6c158c4bdd 100644 --- a/dlls/x11drv/event.c +++ b/dlls/x11drv/event.c @@ -1093,6 +1093,56 @@ static void EVENT_PropertyNotify( XPropertyEvent *event ) } } +static HWND find_drop_window( HWND hQueryWnd, LPPOINT lpPt ) +{ + RECT tempRect; + + if (!IsWindowEnabled(hQueryWnd)) return 0; + + GetWindowRect(hQueryWnd, &tempRect); + + if(!PtInRect(&tempRect, *lpPt)) return 0; + + if (!IsIconic( hQueryWnd )) + { + GetClientRect( hQueryWnd, &tempRect ); + MapWindowPoints( hQueryWnd, 0, (LPPOINT)&tempRect, 2 ); + + if (PtInRect( &tempRect, *lpPt)) + { + HWND *list = WIN_ListChildren( hQueryWnd ); + HWND bResult = 0; + + if (list) + { + int i; + + for (i = 0; list[i]; i++) + { + if (GetWindowLongW( list[i], GWL_STYLE ) & WS_VISIBLE) + { + GetWindowRect( list[i], &tempRect ); + if (PtInRect( &tempRect, *lpPt )) break; + } + } + if (list[i]) + { + if (IsWindowEnabled( list[i] )) + bResult = find_drop_window( list[i], lpPt ); + } + HeapFree( GetProcessHeap(), 0, list ); + } + if(bResult) return bResult; + } + } + + if(!(GetWindowLongA( hQueryWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return 0; + + ScreenToClient(hQueryWnd, lpPt); + + return hQueryWnd; +} + /********************************************************************** * EVENT_DropFromOffix * @@ -1100,49 +1150,55 @@ static void EVENT_PropertyNotify( XPropertyEvent *event ) */ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) { - unsigned long data_length; - unsigned long aux_long; - unsigned char* p_data = NULL; - union { - Atom atom_aux; - struct { - int x; - int y; - } pt_aux; - int i; - } u; - int x, y; - BOOL16 bAccept; - HGLOBAL16 hDragInfo = GlobalAlloc16( GMEM_SHARE | GMEM_ZEROINIT, sizeof(DRAGINFO16)); - LPDRAGINFO16 lpDragInfo = (LPDRAGINFO16) GlobalLock16(hDragInfo); - SEGPTR spDragInfo = K32WOWGlobalLock16(hDragInfo); - Window w_aux_root, w_aux_child; - WND* pWnd; + unsigned long data_length; + unsigned long aux_long; + unsigned char* p_data = NULL; + union { + Atom atom_aux; + struct { + int x; + int y; + } pt_aux; + int i; + } u; + int x, y; + BOOL bAccept; + Window w_aux_root, w_aux_child; + WND* pWnd; + HWND hScope = hWnd; - if( !lpDragInfo || !spDragInfo ) return; + pWnd = WIN_FindWndPtr(hWnd); - pWnd = WIN_FindWndPtr(hWnd); + TSXQueryPointer( event->display, get_whole_window(pWnd), &w_aux_root, &w_aux_child, + &x, &y, (int *) &u.pt_aux.x, (int *) &u.pt_aux.y, + (unsigned int*)&aux_long); - TSXQueryPointer( event->display, get_whole_window(pWnd), &w_aux_root, &w_aux_child, - &x, &y, (int *) &u.pt_aux.x, (int *) &u.pt_aux.y, - (unsigned int*)&aux_long); - - lpDragInfo->hScope = HWND_16(hWnd); - lpDragInfo->pt.x = (INT16)x; lpDragInfo->pt.y = (INT16)y; - - /* find out drop point and drop window */ - if( x < 0 || y < 0 || - x > (pWnd->rectWindow.right - pWnd->rectWindow.left) || - y > (pWnd->rectWindow.bottom - pWnd->rectWindow.top) ) - { bAccept = pWnd->dwExStyle & WS_EX_ACCEPTFILES; x = y = 0; } - else - { - bAccept = DRAG_QueryUpdate( hWnd, spDragInfo, TRUE ); - x = lpDragInfo->pt.x; y = lpDragInfo->pt.y; + /* find out drop point and drop window */ + if( x < 0 || y < 0 || + x > (pWnd->rectWindow.right - pWnd->rectWindow.left) || + y > (pWnd->rectWindow.bottom - pWnd->rectWindow.top) ) + { + bAccept = pWnd->dwExStyle & WS_EX_ACCEPTFILES; + x = 0; + y = 0; } - WIN_ReleaseWndPtr(pWnd); - - GlobalFree16( hDragInfo ); + else + { + POINT pt = { x, y }; + HWND hwndDrop = find_drop_window( hWnd, &pt ); + if (hwndDrop) + { + x = pt.x; + y = pt.y; + hScope = hwndDrop; + bAccept = TRUE; + } + else + { + bAccept = FALSE; + } + } + WIN_ReleaseWndPtr(pWnd); if (!bAccept) return; @@ -1179,7 +1235,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) if( lpDrop ) { - WND *pDropWnd = WIN_FindWndPtr( HWND_32(lpDragInfo->hScope) ); + WND *pDropWnd = WIN_FindWndPtr( hScope ); lpDrop->pFiles = sizeof(DROPFILES); lpDrop->pt.x = x; lpDrop->pt.y = y; diff --git a/windows/win.c b/windows/win.c index f84b8dff36..60940a612d 100644 --- a/windows/win.c +++ b/windows/win.c @@ -3112,12 +3112,12 @@ BOOL WINAPI SetWindowContextHelpId( HWND hwnd, DWORD id ) /******************************************************************* - * DRAG_QueryUpdate + * DRAG_QueryUpdate16 * * recursively find a child that contains spDragInfo->pt point * and send WM_QUERYDROPOBJECT */ -BOOL16 DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo, BOOL bNoSend ) +static BOOL16 DRAG_QueryUpdate16( HWND hQueryWnd, SEGPTR spDragInfo ) { BOOL16 wParam, bResult = 0; POINT pt; @@ -3157,7 +3157,7 @@ BOOL16 DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo, BOOL bNoSend ) if (list[i]) { if (IsWindowEnabled( list[i] )) - bResult = DRAG_QueryUpdate( list[i], spDragInfo, bNoSend ); + bResult = DRAG_QueryUpdate16( list[i], spDragInfo ); } HeapFree( GetProcessHeap(), 0, list ); } @@ -3171,9 +3171,7 @@ BOOL16 DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo, BOOL bNoSend ) ptrDragInfo->hScope = HWND_16(hQueryWnd); - if (bNoSend) bResult = (GetWindowLongA( hQueryWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES) != 0; - else bResult = SendMessage16( HWND_16(hQueryWnd), WM_QUERYDROPOBJECT, - (WPARAM16)wParam, spDragInfo ); + bResult = SendMessage16( HWND_16(hQueryWnd), WM_QUERYDROPOBJECT, (WPARAM16)wParam, spDragInfo ); if( !bResult ) CONV_POINT32TO16( &pt, &ptrDragInfo->pt ); @@ -3272,7 +3270,7 @@ DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj, /* update DRAGINFO struct */ TRACE_(msg)("lpDI->hScope = %04x\n",lpDragInfo->hScope); - if( DRAG_QueryUpdate(WIN_Handle32(hwndScope), spDragInfo, FALSE) > 0 ) + if( DRAG_QueryUpdate16(WIN_Handle32(hwndScope), spDragInfo) > 0 ) hCurrentCursor = hCursor; else {