diff --git a/controls/listbox.c b/controls/listbox.c index 23d70da82d4..961b1742b2c 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -3005,19 +3005,6 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg, SendMessageA( descr->owner, msg, wParam, lParam ); break; - case WM_DROPOBJECT: - case WM_QUERYDROPOBJECT: - case WM_DRAGSELECT: - case WM_DRAGMOVE: - if( !descr->lphc ) - { - LPDRAGINFO16 dragInfo = MapSL( lParam ); - dragInfo->l = LISTBOX_GetItemFromPoint( descr, dragInfo->pt.x, - dragInfo->pt.y ); - return SendMessage16( HWND_16(descr->owner), msg, wParam, lParam ); - } - break; - default: if ((msg >= WM_USER) && (msg < 0xc000)) WARN("[%04x]: unknown msg %04x wp %08x lp %08lx\n", diff --git a/dlls/user/user16.c b/dlls/user/user16.c index e43893a28ea..02d2b1ea06e 100644 --- a/dlls/user/user16.c +++ b/dlls/user/user16.c @@ -22,6 +22,7 @@ #include "winbase.h" #include "wownt32.h" #include "user.h" +#include "win.h" /* handle to handle 16 conversions */ #define HANDLE_16(h32) (LOWORD(h32)) @@ -267,6 +268,149 @@ BOOL16 WINAPI DestroyCursor16(HCURSOR16 hCursor) return DestroyIcon32(hCursor, 0); } +/******************************************************************* + * DRAG_QueryUpdate16 + * + * Recursively find a child that contains spDragInfo->pt point + * and send WM_QUERYDROPOBJECT. Helper for DragObject16. + */ +static BOOL DRAG_QueryUpdate16( HWND hQueryWnd, SEGPTR spDragInfo ) +{ + BOOL bResult = 0; + WPARAM wParam; + POINT pt, old_pt; + LPDRAGINFO16 ptrDragInfo = MapSL(spDragInfo); + RECT tempRect; + HWND child; + + if (!IsWindowEnabled(hQueryWnd)) return FALSE; + + old_pt.x = ptrDragInfo->pt.x; + old_pt.y = ptrDragInfo->pt.y; + pt = old_pt; + ScreenToClient( hQueryWnd, &pt ); + child = ChildWindowFromPointEx( hQueryWnd, pt, CWP_SKIPINVISIBLE ); + if (!child) return FALSE; + + if (child != hQueryWnd) + { + wParam = 0; + if (DRAG_QueryUpdate16( child, spDragInfo )) return TRUE; + } + else + { + GetClientRect( hQueryWnd, &tempRect ); + wParam = !PtInRect( &tempRect, pt ); + } + + ptrDragInfo->pt.x = pt.x; + ptrDragInfo->pt.y = pt.y; + ptrDragInfo->hScope = HWND_16(hQueryWnd); + + bResult = SendMessage16( HWND_16(hQueryWnd), WM_QUERYDROPOBJECT, wParam, spDragInfo ); + + if (!bResult) + { + ptrDragInfo->pt.x = old_pt.x; + ptrDragInfo->pt.y = old_pt.y; + } + return bResult; +} + + +/****************************************************************************** + * DragObject (USER.464) + */ +DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj, + HANDLE16 hOfStruct, WORD szList, HCURSOR16 hCursor ) +{ + MSG msg; + LPDRAGINFO16 lpDragInfo; + SEGPTR spDragInfo; + HCURSOR hOldCursor=0, hBummer=0; + HGLOBAL16 hDragInfo = GlobalAlloc16( GMEM_SHARE | GMEM_ZEROINIT, 2*sizeof(DRAGINFO16)); + HCURSOR hCurrentCursor = 0; + HWND16 hCurrentWnd = 0; + + lpDragInfo = (LPDRAGINFO16) GlobalLock16(hDragInfo); + spDragInfo = K32WOWGlobalLock16(hDragInfo); + + if( !lpDragInfo || !spDragInfo ) return 0L; + + if (!(hBummer = LoadCursorA(0, MAKEINTRESOURCEA(OCR_NO)))) + { + GlobalFree16(hDragInfo); + return 0L; + } + + if(hCursor) hOldCursor = SetCursor(HCURSOR_32(hCursor)); + + lpDragInfo->hWnd = hWnd; + lpDragInfo->hScope = 0; + lpDragInfo->wFlags = wObj; + lpDragInfo->hList = szList; /* near pointer! */ + lpDragInfo->hOfStruct = hOfStruct; + lpDragInfo->l = 0L; + + SetCapture( HWND_32(hWnd) ); + ShowCursor( TRUE ); + + do + { + GetMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST ); + + *(lpDragInfo+1) = *lpDragInfo; + + lpDragInfo->pt.x = msg.pt.x; + lpDragInfo->pt.y = msg.pt.y; + + /* update DRAGINFO struct */ + if( DRAG_QueryUpdate16(WIN_Handle32(hwndScope), spDragInfo) > 0 ) + hCurrentCursor = HCURSOR_32(hCursor); + else + { + hCurrentCursor = hBummer; + lpDragInfo->hScope = 0; + } + if( hCurrentCursor ) + SetCursor(hCurrentCursor); + + /* send WM_DRAGLOOP */ + SendMessage16( hWnd, WM_DRAGLOOP, (WPARAM16)(hCurrentCursor != hBummer), + (LPARAM) spDragInfo ); + /* send WM_DRAGSELECT or WM_DRAGMOVE */ + if( hCurrentWnd != lpDragInfo->hScope ) + { + if( hCurrentWnd ) + SendMessage16( hCurrentWnd, WM_DRAGSELECT, 0, + (LPARAM)MAKELONG(LOWORD(spDragInfo)+sizeof(DRAGINFO16), + HIWORD(spDragInfo)) ); + hCurrentWnd = lpDragInfo->hScope; + if( hCurrentWnd ) + SendMessage16( hCurrentWnd, WM_DRAGSELECT, 1, (LPARAM)spDragInfo); + } + else + if( hCurrentWnd ) + SendMessage16( hCurrentWnd, WM_DRAGMOVE, 0, (LPARAM)spDragInfo); + + } while( msg.message != WM_LBUTTONUP && msg.message != WM_NCLBUTTONUP ); + + ReleaseCapture(); + ShowCursor( FALSE ); + + if( hCursor ) SetCursor(hOldCursor); + + if( hCurrentCursor != hBummer ) + msg.lParam = SendMessage16( lpDragInfo->hScope, WM_DROPOBJECT, + (WPARAM16)hWnd, (LPARAM)spDragInfo ); + else + msg.lParam = 0; + GlobalFree16(hDragInfo); + + return (DWORD)(msg.lParam); +} + + /********************************************************************** * DrawFrameControl (USER.656) */ diff --git a/dlls/user/user32.spec b/dlls/user/user32.spec index 3f2e15c465a..44e851466a2 100644 --- a/dlls/user/user32.spec +++ b/dlls/user/user32.spec @@ -672,7 +672,6 @@ init UserClientDllInitialize @ stdcall DialogBoxIndirectParam16(long long long long long) DialogBoxIndirectParam16 @ stdcall GetDriverModuleHandle16(long) GetDriverModuleHandle16 @ stdcall OpenDriver16(str str long) OpenDriver16 -@ stdcall PostAppMessage16(long long long long) PostAppMessage16 @ stdcall SendDriverMessage16(long long long long) SendDriverMessage16 @ stdcall UserYield16() UserYield16 @@ -696,7 +695,6 @@ init UserClientDllInitialize @ cdecl WINPOS_ShowIconTitle(long long) WINPOS_ShowIconTitle @ cdecl WIN_FindWndPtr(long) WIN_FindWndPtr @ cdecl WIN_GetPtr(long) WIN_GetPtr -@ cdecl WIN_Handle32(long) WIN_Handle32 @ cdecl WIN_LinkWindow(long long long) WIN_LinkWindow @ cdecl WIN_ListChildren(long) WIN_ListChildren @ cdecl WIN_ListParents(long) WIN_ListParents diff --git a/dlls/winmm/mmsystem.c b/dlls/winmm/mmsystem.c index 0ae092e882f..d90cefb8880 100644 --- a/dlls/winmm/mmsystem.c +++ b/dlls/winmm/mmsystem.c @@ -1813,7 +1813,7 @@ void WINAPI mmTaskBlock16(HINSTANCE16 WINE_UNUSED hInst) LRESULT WINAPI mmTaskSignal16(HTASK16 ht) { TRACE("(%04x);\n", ht); - return PostAppMessage16(ht, WM_USER, 0, 0); + return PostThreadMessageW( HTASK_32(ht), WM_USER, 0, 0 ); } /************************************************************************** diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c index fd5da7cdf77..b03c7fb1580 100644 --- a/dlls/x11drv/winpos.c +++ b/dlls/x11drv/winpos.c @@ -749,7 +749,6 @@ static BOOL fixup_flags( WINDOWPOS *winpos ) /* hwndInsertAfter must be a sibling of the window */ if ((winpos->hwndInsertAfter != HWND_TOP) && (winpos->hwndInsertAfter != HWND_BOTTOM)) { - winpos->hwndInsertAfter = WIN_GetFullHandle( winpos->hwndInsertAfter ); if (GetAncestor( winpos->hwndInsertAfter, GA_PARENT ) != wndPtr->parent) ret = FALSE; else { diff --git a/windows/win.c b/windows/win.c index c974455a0a8..649d071c15d 100644 --- a/windows/win.c +++ b/windows/win.c @@ -3133,76 +3133,6 @@ BOOL WINAPI SetWindowContextHelpId( HWND hwnd, DWORD id ) } -/******************************************************************* - * DRAG_QueryUpdate16 - * - * recursively find a child that contains spDragInfo->pt point - * and send WM_QUERYDROPOBJECT - */ -static BOOL16 DRAG_QueryUpdate16( HWND hQueryWnd, SEGPTR spDragInfo ) -{ - BOOL16 wParam, bResult = 0; - POINT pt, client_pt; - LPDRAGINFO16 ptrDragInfo = MapSL(spDragInfo); - RECT tempRect; - - if (!ptrDragInfo) return FALSE; - - CONV_POINT16TO32( &ptrDragInfo->pt, &pt ); - - GetWindowRect(hQueryWnd,&tempRect); - - if( !PtInRect(&tempRect,pt) || !IsWindowEnabled(hQueryWnd)) return FALSE; - - if (!IsIconic( hQueryWnd )) - { - GetClientRect( hQueryWnd, &tempRect ); - MapWindowPoints( hQueryWnd, 0, (LPPOINT)&tempRect, 2 ); - - if (PtInRect( &tempRect, pt)) - { - int i; - HWND *list = WIN_ListChildren( hQueryWnd ); - - wParam = 0; - - if (list) - { - for (i = 0; list[i]; i++) - { - if (GetWindowLongW( list[i], GWL_STYLE ) & WS_VISIBLE) - { - GetWindowRect( list[i], &tempRect ); - if (PtInRect( &tempRect, pt )) break; - } - } - if (list[i]) - { - if (IsWindowEnabled( list[i] )) - bResult = DRAG_QueryUpdate16( list[i], spDragInfo ); - } - HeapFree( GetProcessHeap(), 0, list ); - } - if(bResult) return bResult; - } - else wParam = 1; - } - else wParam = 1; - - client_pt = pt; - ScreenToClient( hQueryWnd, &client_pt ); - ptrDragInfo->pt.x = client_pt.x; - ptrDragInfo->pt.y = client_pt.y; - ptrDragInfo->hScope = HWND_16(hQueryWnd); - - bResult = SendMessage16( HWND_16(hQueryWnd), WM_QUERYDROPOBJECT, (WPARAM16)wParam, spDragInfo ); - - if( !bResult ) CONV_POINT32TO16( &pt, &ptrDragInfo->pt ); - - return bResult; -} - - /******************************************************************* * DragDetect (USER32.@) */ @@ -3245,101 +3175,6 @@ BOOL WINAPI DragDetect( HWND hWnd, POINT pt ) return 0; } -/****************************************************************************** - * DragObject (USER.464) - */ -DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj, - HANDLE16 hOfStruct, WORD szList, HCURSOR16 hCursor ) -{ - MSG msg; - LPDRAGINFO16 lpDragInfo; - SEGPTR spDragInfo; - HCURSOR hOldCursor=0, hBummer=0; - HGLOBAL16 hDragInfo = GlobalAlloc16( GMEM_SHARE | GMEM_ZEROINIT, 2*sizeof(DRAGINFO16)); - HCURSOR hCurrentCursor = 0; - HWND16 hCurrentWnd = 0; - - lpDragInfo = (LPDRAGINFO16) GlobalLock16(hDragInfo); - spDragInfo = K32WOWGlobalLock16(hDragInfo); - - if( !lpDragInfo || !spDragInfo ) return 0L; - - if (!(hBummer = LoadCursorA(0, MAKEINTRESOURCEA(OCR_NO)))) - { - GlobalFree16(hDragInfo); - return 0L; - } - - if(hCursor) hOldCursor = SetCursor(HCURSOR_32(hCursor)); - - lpDragInfo->hWnd = hWnd; - lpDragInfo->hScope = 0; - lpDragInfo->wFlags = wObj; - lpDragInfo->hList = szList; /* near pointer! */ - lpDragInfo->hOfStruct = hOfStruct; - lpDragInfo->l = 0L; - - SetCapture(WIN_Handle32(hWnd)); - ShowCursor( TRUE ); - - do - { - GetMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST ); - - *(lpDragInfo+1) = *lpDragInfo; - - lpDragInfo->pt.x = msg.pt.x; - lpDragInfo->pt.y = msg.pt.y; - - /* update DRAGINFO struct */ - TRACE_(msg)("lpDI->hScope = %04x\n",lpDragInfo->hScope); - - if( DRAG_QueryUpdate16(WIN_Handle32(hwndScope), spDragInfo) > 0 ) - hCurrentCursor = HCURSOR_32(hCursor); - else - { - hCurrentCursor = hBummer; - lpDragInfo->hScope = 0; - } - if( hCurrentCursor ) - SetCursor(hCurrentCursor); - - /* send WM_DRAGLOOP */ - SendMessage16( hWnd, WM_DRAGLOOP, (WPARAM16)(hCurrentCursor != hBummer), - (LPARAM) spDragInfo ); - /* send WM_DRAGSELECT or WM_DRAGMOVE */ - if( hCurrentWnd != lpDragInfo->hScope ) - { - if( hCurrentWnd ) - SendMessage16( hCurrentWnd, WM_DRAGSELECT, 0, - (LPARAM)MAKELONG(LOWORD(spDragInfo)+sizeof(DRAGINFO16), - HIWORD(spDragInfo)) ); - hCurrentWnd = lpDragInfo->hScope; - if( hCurrentWnd ) - SendMessage16( hCurrentWnd, WM_DRAGSELECT, 1, (LPARAM)spDragInfo); - } - else - if( hCurrentWnd ) - SendMessage16( hCurrentWnd, WM_DRAGMOVE, 0, (LPARAM)spDragInfo); - - } while( msg.message != WM_LBUTTONUP && msg.message != WM_NCLBUTTONUP ); - - ReleaseCapture(); - ShowCursor( FALSE ); - - if( hCursor ) SetCursor(hOldCursor); - - if( hCurrentCursor != hBummer ) - msg.lParam = SendMessage16( lpDragInfo->hScope, WM_DROPOBJECT, - (WPARAM16)hWnd, (LPARAM)spDragInfo ); - else - msg.lParam = 0; - GlobalFree16(hDragInfo); - - return (DWORD)(msg.lParam); -} - - /****************************************************************************** * GetWindowModuleFileNameA (USER32.@) */ diff --git a/windows/winpos.c b/windows/winpos.c index abb89e83a9f..673b4aa6e09 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -1177,8 +1177,8 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter, hwnd, hwndInsertAfter, x, y, cx, cy, flags); if(TRACE_ON(win)) dump_winpos_flags(flags); - winpos.hwnd = hwnd; - winpos.hwndInsertAfter = hwndInsertAfter; + winpos.hwnd = WIN_GetFullHandle(hwnd); + winpos.hwndInsertAfter = WIN_GetFullHandle(hwndInsertAfter); winpos.x = x; winpos.y = y; winpos.cx = cx; @@ -1242,7 +1242,7 @@ HDWP WINAPI DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter, /* Merge with the other changes */ if (!(flags & SWP_NOZORDER)) { - pDWP->winPos[i].hwndInsertAfter = hwndAfter; + pDWP->winPos[i].hwndInsertAfter = WIN_GetFullHandle(hwndAfter); } if (!(flags & SWP_NOMOVE)) {