win32u: Copy implementation of AdjustWindowRectEx from user32.

It will be useful for drivers as well.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-15 20:43:19 +02:00 committed by Alexandre Julliard
parent d2d715b201
commit 033cad432e
4 changed files with 39 additions and 5 deletions

View File

@ -159,7 +159,6 @@ static void CDECL free_win_ptr( WND *win )
static const struct user_callbacks user_funcs =
{
AdjustWindowRectEx,
CopyImage,
EndMenu,
ImmProcessKey,

View File

@ -31,6 +31,44 @@
WINE_DEFAULT_DEBUG_CHANNEL(win);
/***********************************************************************
* AdjustWindowRectEx (win32u.so)
*/
BOOL WINAPI AdjustWindowRectEx( RECT *rect, DWORD style, BOOL menu, DWORD ex_style )
{
NONCLIENTMETRICSW ncm;
int adjust = 0;
ncm.cbSize = sizeof(ncm);
NtUserSystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
if ((ex_style & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE)
adjust = 1; /* for the outer frame always present */
else if ((ex_style & WS_EX_DLGMODALFRAME) || (style & (WS_THICKFRAME|WS_DLGFRAME)))
adjust = 2; /* outer */
if (style & WS_THICKFRAME)
adjust += ncm.iBorderWidth + ncm.iPaddedBorderWidth; /* The resize border */
if ((style & (WS_BORDER|WS_DLGFRAME)) || (ex_style & WS_EX_DLGMODALFRAME))
adjust++; /* The other border */
InflateRect( rect, adjust, adjust );
if ((style & WS_CAPTION) == WS_CAPTION)
{
if (ex_style & WS_EX_TOOLWINDOW)
rect->top -= ncm.iSmCaptionHeight + 1;
else
rect->top -= ncm.iCaptionHeight + 1;
}
if (menu) rect->top -= ncm.iMenuHeight + 1;
if (ex_style & WS_EX_CLIENTEDGE)
InflateRect( rect, get_system_metrics(SM_CXEDGE), get_system_metrics(SM_CYEDGE) );
return TRUE;
}
static BOOL set_window_text( HWND hwnd, const void *text, BOOL ansi )
{
static const WCHAR emptyW[] = { 0 };

View File

@ -32,7 +32,6 @@ struct hardware_msg_data;
struct user_callbacks
{
BOOL (WINAPI *pAdjustWindowRectEx)( RECT *, DWORD, BOOL, DWORD );
HANDLE (WINAPI *pCopyImage)( HANDLE, UINT, INT, INT, UINT );
BOOL (WINAPI *pEndMenu)(void);
BOOL (WINAPI *pImmProcessKey)(HWND, HKL, UINT, LPARAM, DWORD);

View File

@ -3683,9 +3683,7 @@ static MINMAXINFO get_min_max_info( HWND hwnd )
adjusted_style = style;
get_client_rect( NtUserGetAncestor( hwnd, GA_PARENT ), &rc );
if (user_callbacks)
user_callbacks->pAdjustWindowRectEx( &rc, adjusted_style,
(style & WS_POPUP) && get_menu( hwnd ), exstyle);
AdjustWindowRectEx( &rc, adjusted_style, (style & WS_POPUP) && get_menu( hwnd ), exstyle );
xinc = -rc.left;
yinc = -rc.top;