win32u: Move default WM_WINDOWPOSCHANGING implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-05-11 21:26:52 +02:00 committed by Alexandre Julliard
parent 63ce060e5b
commit b9a40c4b26
6 changed files with 24 additions and 30 deletions

View File

@ -180,9 +180,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
NC_HandleNCCalcSize( hwnd, wParam, (RECT *)lParam ); NC_HandleNCCalcSize( hwnd, wParam, (RECT *)lParam );
break; break;
case WM_WINDOWPOSCHANGING:
return WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam );
case WM_WINDOWPOSCHANGED: case WM_WINDOWPOSCHANGED:
DEFWND_HandleWindowPosChanged( hwnd, (const WINDOWPOS *)lParam ); DEFWND_HandleWindowPosChanged( hwnd, (const WINDOWPOS *)lParam );
break; break;

View File

@ -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 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 HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest ) DECLSPEC_HIDDEN;
extern void WINPOS_ActivateOtherWindow( HWND hwnd ) DECLSPEC_HIDDEN; extern void WINPOS_ActivateOtherWindow( HWND hwnd ) DECLSPEC_HIDDEN;
extern void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam ) DECLSPEC_HIDDEN; extern void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam ) DECLSPEC_HIDDEN;

View File

@ -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.@) * BeginDeferWindowPos (USER32.@)
*/ */

View File

@ -195,6 +195,25 @@ static HICON set_window_icon( HWND hwnd, WPARAM type, HICON icon )
return ret; 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 ) static LRESULT handle_sys_command( HWND hwnd, WPARAM wparam, LPARAM lparam )
{ {
if (!is_window_enabled( hwnd )) return 0; if (!is_window_enabled( hwnd )) return 0;
@ -255,6 +274,9 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
break; break;
} }
case WM_WINDOWPOSCHANGING:
return handle_window_pos_changing( hwnd, (WINDOWPOS *)lparam );
case WM_PAINTICON: case WM_PAINTICON:
case WM_PAINT: case WM_PAINT:
{ {

View File

@ -434,6 +434,7 @@ extern HWND get_parent( HWND hwnd ) DECLSPEC_HIDDEN;
extern HWND get_hwnd_message_parent(void) 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 DPI_AWARENESS_CONTEXT get_window_dpi_awareness_context( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL get_window_placement( HWND hwnd, WINDOWPLACEMENT *placement ) 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 HWND get_window_relative( HWND hwnd, UINT rel ) DECLSPEC_HIDDEN;
extern DWORD get_window_thread( HWND hwnd, DWORD *process ) DECLSPEC_HIDDEN; extern DWORD get_window_thread( HWND hwnd, DWORD *process ) DECLSPEC_HIDDEN;
extern HWND is_current_process_window( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND is_current_process_window( HWND hwnd ) DECLSPEC_HIDDEN;

View File

@ -3657,7 +3657,7 @@ static void send_parent_notify( HWND hwnd, UINT msg )
* *
* Get the minimized and maximized information for a window. * 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 style = get_window_long( hwnd, GWL_STYLE );
LONG exstyle = get_window_long( hwnd, GWL_EXSTYLE ); LONG exstyle = get_window_long( hwnd, GWL_EXSTYLE );