diff --git a/dlls/user/msg16.c b/dlls/user/msg16.c index 9bec8aeb6b1..3be36d2b0d1 100644 --- a/dlls/user/msg16.c +++ b/dlls/user/msg16.c @@ -172,6 +172,99 @@ BOOL16 WINAPI PeekMessage32_16( MSG32_16 *msg16, HWND16 hwnd16, } +/*********************************************************************** + * DefWindowProc (USER.107) + */ +LRESULT WINAPI DefWindowProc16( HWND16 hwnd16, UINT16 msg, WPARAM16 wParam, LPARAM lParam ) +{ + LRESULT result; + HWND hwnd = WIN_Handle32( hwnd16 ); + + SPY_EnterMessage( SPY_DEFWNDPROC16, hwnd, msg, wParam, lParam ); + + switch(msg) + { + case WM_NCCREATE: + { + CREATESTRUCT16 *cs16 = MapSL(lParam); + CREATESTRUCTA cs32; + + cs32.lpCreateParams = (LPVOID)cs16->lpCreateParams; + cs32.hInstance = HINSTANCE_32(cs16->hInstance); + cs32.hMenu = HMENU_32(cs16->hMenu); + cs32.hwndParent = WIN_Handle32(cs16->hwndParent); + cs32.cy = cs16->cy; + cs32.cx = cs16->cx; + cs32.y = cs16->y; + cs32.x = cs16->x; + cs32.style = cs16->style; + cs32.dwExStyle = cs16->dwExStyle; + cs32.lpszName = MapSL(cs16->lpszName); + cs32.lpszClass = MapSL(cs16->lpszClass); + result = DefWindowProcA( hwnd, msg, wParam, (LPARAM)&cs32 ); + } + break; + + case WM_NCCALCSIZE: + { + RECT16 *rect16 = MapSL(lParam); + RECT rect32; + + rect32.left = rect16->left; + rect32.top = rect16->top; + rect32.right = rect16->right; + rect32.bottom = rect16->bottom; + + result = DefWindowProcA( hwnd, msg, wParam, (LPARAM)&rect32 ); + + rect16->left = rect32.left; + rect16->top = rect32.top; + rect16->right = rect32.right; + rect16->bottom = rect32.bottom; + } + break; + + case WM_WINDOWPOSCHANGING: + case WM_WINDOWPOSCHANGED: + { + WINDOWPOS16 *pos16 = MapSL(lParam); + WINDOWPOS pos32; + + pos32.hwnd = WIN_Handle32(pos16->hwnd); + pos32.hwndInsertAfter = WIN_Handle32(pos16->hwndInsertAfter); + pos32.x = pos16->x; + pos32.y = pos16->y; + pos32.cx = pos16->cx; + pos32.cy = pos16->cy; + pos32.flags = pos16->flags; + + result = DefWindowProcA( hwnd, msg, wParam, (LPARAM)&pos32 ); + + pos16->hwnd = HWND_16(pos32.hwnd); + pos16->hwndInsertAfter = HWND_16(pos32.hwndInsertAfter); + pos16->x = pos32.x; + pos16->y = pos32.y; + pos16->cx = pos32.cx; + pos16->cy = pos32.cy; + pos16->flags = pos32.flags; + } + break; + + case WM_GETTEXT: + case WM_SETTEXT: + result = DefWindowProcA( hwnd, msg, wParam, (LPARAM)MapSL(lParam) ); + break; + + default: + result = DefWindowProcA( hwnd, msg, wParam, lParam ); + break; + } + + SPY_ExitMessage( SPY_RESULT_DEFWND16, hwnd, msg, result, wParam, lParam ); + return result; +} + + /*********************************************************************** * PeekMessage (USER.109) */ diff --git a/include/winpos.h b/include/winpos.h index 3669d63a7c1..369432a88a7 100644 --- a/include/winpos.h +++ b/include/winpos.h @@ -34,13 +34,10 @@ /* Wine extra SWP flag */ #define SWP_WINE_NOHOSTMOVE 0x80000000 -struct tagWINDOWPOS16; - extern BOOL WINPOS_RedrawIconTitle( HWND hWnd ); extern BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow ); extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack ); -extern LONG WINPOS_HandleWindowPosChanging16(HWND hwnd, struct tagWINDOWPOS16 *winpos); extern LONG WINPOS_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos); extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest ); extern void WINPOS_CheckInternalPos( HWND hwnd ); diff --git a/windows/defwnd.c b/windows/defwnd.c index a6e23af401f..f5b9c974062 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -55,7 +55,7 @@ static const WCHAR imm32W[] = { 'i','m','m','3','2','\0' }; * * Handle the WM_WINDOWPOSCHANGED message. */ -static void DEFWND_HandleWindowPosChanged( HWND hwnd, UINT flags ) +static void DEFWND_HandleWindowPosChanged( HWND hwnd, const WINDOWPOS *winpos ) { RECT rect; WND *wndPtr = WIN_GetPtr( hwnd ); @@ -63,10 +63,10 @@ static void DEFWND_HandleWindowPosChanged( HWND hwnd, UINT flags ) rect = wndPtr->rectClient; WIN_ReleasePtr( wndPtr ); - if (!(flags & SWP_NOCLIENTMOVE)) + if (!(winpos->flags & SWP_NOCLIENTMOVE)) SendMessageW( hwnd, WM_MOVE, 0, MAKELONG(rect.left, rect.top)); - if (!(flags & SWP_NOCLIENTSIZE)) + if (!(winpos->flags & SWP_NOCLIENTSIZE)) { WPARAM wp = SIZE_RESTORED; if (IsZoomed(hwnd)) wp = SIZE_MAXIMIZED; @@ -318,7 +318,7 @@ static BOOL DEFWND_ImmIsUIMessageW( HWND hwndIME, UINT msg, WPARAM wParam, LPARA /*********************************************************************** * DEFWND_DefWinProc * - * Default window procedure for messages that are the same in Win16 and Win32. + * Default window procedure for messages that are the same in Ansi and Unicode. */ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { @@ -335,6 +335,16 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa return NC_HandleNCHitTest( hwnd, pt ); } + case WM_NCCALCSIZE: + return NC_HandleNCCalcSize( hwnd, (RECT *)lParam ); + + case WM_WINDOWPOSCHANGING: + return WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam ); + + case WM_WINDOWPOSCHANGED: + DEFWND_HandleWindowPosChanged( hwnd, (const WINDOWPOS *)lParam ); + break; + case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: @@ -714,79 +724,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa -/*********************************************************************** - * DefWindowProc (USER.107) - */ -LRESULT WINAPI DefWindowProc16( HWND16 hwnd16, UINT16 msg, WPARAM16 wParam, - LPARAM lParam ) -{ - LRESULT result = 0; - HWND hwnd = WIN_Handle32( hwnd16 ); - - if (!WIN_IsCurrentProcess( hwnd )) - { - if (!IsWindow( hwnd )) return 0; - ERR( "called for other process window %p\n", hwnd ); - return 0; - } - SPY_EnterMessage( SPY_DEFWNDPROC16, hwnd, msg, wParam, lParam ); - - switch(msg) - { - case WM_NCCREATE: - { - CREATESTRUCT16 *cs = MapSL(lParam); - /* check for string, as static icons, bitmaps (SS_ICON, SS_BITMAP) - * may have child window IDs instead of window name */ - if (HIWORD(cs->lpszName)) - DEFWND_SetTextA( hwnd, MapSL(cs->lpszName) ); - result = 1; - } - break; - - case WM_NCCALCSIZE: - { - RECT rect32; - RECT16 *rect16 = MapSL(lParam); - - rect32.left = rect16->left; - rect32.top = rect16->top; - rect32.right = rect16->right; - rect32.bottom = rect16->bottom; - result = NC_HandleNCCalcSize( hwnd, &rect32 ); - rect16->left = rect32.left; - rect16->top = rect32.top; - rect16->right = rect32.right; - rect16->bottom = rect32.bottom; - } - break; - - case WM_WINDOWPOSCHANGING: - result = WINPOS_HandleWindowPosChanging16( hwnd, MapSL(lParam) ); - break; - - case WM_WINDOWPOSCHANGED: - { - WINDOWPOS16 * winPos = MapSL(lParam); - DEFWND_HandleWindowPosChanged( hwnd, winPos->flags ); - } - break; - - case WM_GETTEXT: - case WM_SETTEXT: - result = DefWindowProcA( hwnd, msg, wParam, (LPARAM)MapSL(lParam) ); - break; - - default: - result = DefWindowProcA( hwnd, msg, wParam, lParam ); - break; - } - - SPY_ExitMessage( SPY_RESULT_DEFWND16, hwnd, msg, result, wParam, lParam ); - return result; -} - - /*********************************************************************** * DefWindowProcA (USER32.@) * @@ -819,21 +756,6 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam } break; - case WM_NCCALCSIZE: - result = NC_HandleNCCalcSize( hwnd, (RECT *)lParam ); - break; - - case WM_WINDOWPOSCHANGING: - result = WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam ); - break; - - case WM_WINDOWPOSCHANGED: - { - WINDOWPOS * winPos = (WINDOWPOS *)lParam; - DEFWND_HandleWindowPosChanged( hwnd, winPos->flags ); - } - break; - case WM_GETTEXTLENGTH: { WND *wndPtr = WIN_GetPtr( hwnd ); @@ -975,21 +897,6 @@ LRESULT WINAPI DefWindowProcW( } break; - case WM_NCCALCSIZE: - result = NC_HandleNCCalcSize( hwnd, (RECT *)lParam ); - break; - - case WM_WINDOWPOSCHANGING: - result = WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam ); - break; - - case WM_WINDOWPOSCHANGED: - { - WINDOWPOS * winPos = (WINDOWPOS *)lParam; - DEFWND_HandleWindowPosChanged( hwnd, winPos->flags ); - } - break; - case WM_GETTEXTLENGTH: { WND *wndPtr = WIN_GetPtr( hwnd ); diff --git a/windows/winpos.c b/windows/winpos.c index 5373e90b8b9..f5fd273075e 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -1100,32 +1100,6 @@ void WINPOS_ActivateOtherWindow(HWND hwnd) } -/*********************************************************************** - * WINPOS_HandleWindowPosChanging16 - * - * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc(). - */ -LONG WINPOS_HandleWindowPosChanging16( HWND hwnd, WINDOWPOS16 *winpos ) -{ - POINT minTrack, maxTrack; - LONG style = GetWindowLongW( hwnd, GWL_STYLE ); - - if (winpos->flags & SWP_NOSIZE) return 0; - if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0)) - { - WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack ); - if (winpos->cx > maxTrack.x) winpos->cx = maxTrack.x; - if (winpos->cy > maxTrack.y) winpos->cy = maxTrack.y; - if (!(style & WS_MINIMIZE)) - { - if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x; - if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y; - } - } - return 0; -} - - /*********************************************************************** * WINPOS_HandleWindowPosChanging *