diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index 74dfa609bbd..c4263edac93 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -180,9 +180,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa NC_HandleNCCalcSize( hwnd, wParam, (RECT *)lParam ); break; - case WM_WINDOWPOSCHANGING: - return WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam ); - case WM_WINDOWPOSCHANGED: DEFWND_HandleWindowPosChanged( hwnd, (const WINDOWPOS *)lParam ); break; diff --git a/dlls/user32/win.h b/dlls/user32/win.h index 0c5bb2be5a8..c9ac3b8e977 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -60,7 +60,6 @@ static inline void WIN_ReleasePtr( WND *ptr ) extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ) DECLSPEC_HIDDEN; -extern LONG WINPOS_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos) DECLSPEC_HIDDEN; extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest ) DECLSPEC_HIDDEN; extern void WINPOS_ActivateOtherWindow( HWND hwnd ) DECLSPEC_HIDDEN; extern void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam ) DECLSPEC_HIDDEN; diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c index cdcd03484cd..a5bc7d9ce17 100644 --- a/dlls/user32/winpos.c +++ b/dlls/user32/winpos.c @@ -653,31 +653,6 @@ void WINPOS_ActivateOtherWindow(HWND hwnd) } -/*********************************************************************** - * WINPOS_HandleWindowPosChanging - * - * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc(). - */ -LONG WINPOS_HandleWindowPosChanging( HWND hwnd, WINDOWPOS *winpos ) -{ - LONG style = GetWindowLongW( hwnd, GWL_STYLE ); - - if (winpos->flags & SWP_NOSIZE) return 0; - if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0)) - { - MINMAXINFO info = NtUserGetMinMaxInfo( hwnd ); - winpos->cx = min( winpos->cx, info.ptMaxTrackSize.x ); - winpos->cy = min( winpos->cy, info.ptMaxTrackSize.y ); - if (!(style & WS_MINIMIZE)) - { - winpos->cx = max( winpos->cx, info.ptMinTrackSize.x ); - winpos->cy = max( winpos->cy, info.ptMinTrackSize.y ); - } - } - return 0; -} - - /*********************************************************************** * BeginDeferWindowPos (USER32.@) */ diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index ec9a1685325..67472246960 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -195,6 +195,25 @@ static HICON set_window_icon( HWND hwnd, WPARAM type, HICON icon ) return ret; } +static LONG handle_window_pos_changing( HWND hwnd, WINDOWPOS *winpos ) +{ + LONG style = get_window_long( hwnd, GWL_STYLE ); + + if (winpos->flags & SWP_NOSIZE) return 0; + if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0)) + { + MINMAXINFO info = get_min_max_info( hwnd ); + winpos->cx = min( winpos->cx, info.ptMaxTrackSize.x ); + winpos->cy = min( winpos->cy, info.ptMaxTrackSize.y ); + if (!(style & WS_MINIMIZE)) + { + winpos->cx = max( winpos->cx, info.ptMinTrackSize.x ); + winpos->cy = max( winpos->cy, info.ptMinTrackSize.y ); + } + } + return 0; +} + static LRESULT handle_sys_command( HWND hwnd, WPARAM wparam, LPARAM lparam ) { if (!is_window_enabled( hwnd )) return 0; @@ -255,6 +274,9 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, break; } + case WM_WINDOWPOSCHANGING: + return handle_window_pos_changing( hwnd, (WINDOWPOS *)lparam ); + case WM_PAINTICON: case WM_PAINT: { diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 63eca06ecd6..e459e6df6bd 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -434,6 +434,7 @@ extern HWND get_parent( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN; extern DPI_AWARENESS_CONTEXT get_window_dpi_awareness_context( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL get_window_placement( HWND hwnd, WINDOWPLACEMENT *placement ) DECLSPEC_HIDDEN; +extern MINMAXINFO get_min_max_info( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND get_window_relative( HWND hwnd, UINT rel ) DECLSPEC_HIDDEN; extern DWORD get_window_thread( HWND hwnd, DWORD *process ) DECLSPEC_HIDDEN; extern HWND is_current_process_window( HWND hwnd ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 94cdd7f7280..31512c03e15 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -3657,7 +3657,7 @@ static void send_parent_notify( HWND hwnd, UINT msg ) * * Get the minimized and maximized information for a window. */ -static MINMAXINFO get_min_max_info( HWND hwnd ) +MINMAXINFO get_min_max_info( HWND hwnd ) { LONG style = get_window_long( hwnd, GWL_STYLE ); LONG exstyle = get_window_long( hwnd, GWL_EXSTYLE );