Commit 300217e3 authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Implement AdjustWindowRectExForDpi().

parent 77013e97
...@@ -323,7 +323,26 @@ BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL ...@@ -323,7 +323,26 @@ BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL
SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 ); SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
adjust_window_rect( rect, style, menu, exStyle, &ncm ); adjust_window_rect( rect, style, menu, exStyle, &ncm );
return TRUE;
}
/***********************************************************************
* AdjustWindowRectExForDpi (USER32.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRectExForDpi( LPRECT rect, DWORD style, BOOL menu,
DWORD exStyle, UINT dpi )
{
NONCLIENTMETRICSW ncm;
if (style & WS_MINIMIZE) return TRUE;
TRACE("(%s) %08x %d %08x %u\n", wine_dbgstr_rect(rect), style, menu, exStyle, dpi );
ncm.cbSize = sizeof(ncm);
SystemParametersInfoForDpi( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0, dpi );
adjust_window_rect( rect, style, menu, exStyle, &ncm );
return TRUE; return TRUE;
} }
......
...@@ -69,6 +69,8 @@ static DWORD (WINAPI *pGetLayout)(HDC hdc); ...@@ -69,6 +69,8 @@ static DWORD (WINAPI *pGetLayout)(HDC hdc);
static BOOL (WINAPI *pMirrorRgn)(HWND hwnd, HRGN hrgn); static BOOL (WINAPI *pMirrorRgn)(HWND hwnd, HRGN hrgn);
static BOOL (WINAPI *pGetWindowDisplayAffinity)(HWND hwnd, DWORD *affinity); static BOOL (WINAPI *pGetWindowDisplayAffinity)(HWND hwnd, DWORD *affinity);
static BOOL (WINAPI *pSetWindowDisplayAffinity)(HWND hwnd, DWORD affinity); static BOOL (WINAPI *pSetWindowDisplayAffinity)(HWND hwnd, DWORD affinity);
static BOOL (WINAPI *pAdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
static BOOL (WINAPI *pSystemParametersInfoForDpi)(UINT,UINT,void*,UINT,UINT);
static BOOL test_lbuttondown_flag; static BOOL test_lbuttondown_flag;
static DWORD num_gettext_msgs; static DWORD num_gettext_msgs;
...@@ -1053,6 +1055,39 @@ static void wine_AdjustWindowRectEx( RECT *rect, LONG style, BOOL menu, LONG exS ...@@ -1053,6 +1055,39 @@ static void wine_AdjustWindowRectEx( RECT *rect, LONG style, BOOL menu, LONG exS
if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL); if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
} }
static void wine_AdjustWindowRectExForDpi( RECT *rect, LONG style, BOOL menu, LONG exStyle, UINT dpi )
{
NONCLIENTMETRICSW ncm;
int adjust = 0;
ncm.cbSize = sizeof(ncm);
pSystemParametersInfoForDpi( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0, dpi );
if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE)
adjust = 1; /* for the outer frame always present */
else if ((exStyle & WS_EX_DLGMODALFRAME) || (style & (WS_THICKFRAME|WS_DLGFRAME)))
adjust = 2; /* outer */
if (style & WS_THICKFRAME) adjust += ncm.iBorderWidth + ncm.iPaddedBorderWidth;
if ((style & (WS_BORDER|WS_DLGFRAME)) || (exStyle & WS_EX_DLGMODALFRAME))
adjust++; /* The other border */
InflateRect (rect, adjust, adjust);
if ((style & WS_CAPTION) == WS_CAPTION)
{
if (exStyle & WS_EX_TOOLWINDOW)
rect->top -= ncm.iSmCaptionHeight + 1;
else
rect->top -= ncm.iCaptionHeight + 1;
}
if (menu) rect->top -= ncm.iMenuHeight + 1;
if (exStyle & WS_EX_CLIENTEDGE)
InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
}
static void test_nonclient_area(HWND hwnd) static void test_nonclient_area(HWND hwnd)
{ {
DWORD style, exstyle; DWORD style, exstyle;
...@@ -5282,8 +5317,15 @@ static void test_AWR_flags(void) ...@@ -5282,8 +5317,15 @@ static void test_AWR_flags(void)
rect2 = rect; rect2 = rect;
AdjustWindowRectEx( &rect, style, FALSE, exstyle ); AdjustWindowRectEx( &rect, style, FALSE, exstyle );
wine_AdjustWindowRectEx( &rect2, style, FALSE, exstyle ); wine_AdjustWindowRectEx( &rect2, style, FALSE, exstyle );
ok( EqualRect( &rect, &rect2 ), "rects do not match: win %s wine %s\n", ok( EqualRect( &rect, &rect2 ), "%08x %08x rects do not match: win %s wine %s\n",
wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &rect2 )); style, exstyle, wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &rect2 ));
if (pAdjustWindowRectExForDpi)
{
pAdjustWindowRectExForDpi( &rect, style, FALSE, exstyle, 192 );
wine_AdjustWindowRectExForDpi( &rect2, style, FALSE, exstyle, 192 );
ok( EqualRect( &rect, &rect2 ), "%08x %08x rects do not match: win %s wine %s\n",
style, exstyle, wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &rect2 ));
}
} }
} }
} }
...@@ -10521,6 +10563,8 @@ START_TEST(win) ...@@ -10521,6 +10563,8 @@ START_TEST(win)
pMirrorRgn = (void *)GetProcAddress( gdi32, "MirrorRgn" ); pMirrorRgn = (void *)GetProcAddress( gdi32, "MirrorRgn" );
pGetWindowDisplayAffinity = (void *)GetProcAddress( user32, "GetWindowDisplayAffinity" ); pGetWindowDisplayAffinity = (void *)GetProcAddress( user32, "GetWindowDisplayAffinity" );
pSetWindowDisplayAffinity = (void *)GetProcAddress( user32, "SetWindowDisplayAffinity" ); pSetWindowDisplayAffinity = (void *)GetProcAddress( user32, "SetWindowDisplayAffinity" );
pAdjustWindowRectExForDpi = (void *)GetProcAddress( user32, "AdjustWindowRectExForDpi" );
pSystemParametersInfoForDpi = (void *)GetProcAddress( user32, "SystemParametersInfoForDpi" );
if (argc==4 && !strcmp(argv[2], "create_children")) if (argc==4 && !strcmp(argv[2], "create_children"))
{ {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
@ stdcall AddClipboardFormatListener(long) @ stdcall AddClipboardFormatListener(long)
@ stdcall AdjustWindowRect(ptr long long) @ stdcall AdjustWindowRect(ptr long long)
@ stdcall AdjustWindowRectEx(ptr long long long) @ stdcall AdjustWindowRectEx(ptr long long long)
@ stdcall AdjustWindowRectExForDpi(ptr long long long long)
@ stdcall AlignRects(ptr long long long) @ stdcall AlignRects(ptr long long long)
# @ stub AllowForegroundActivation # @ stub AllowForegroundActivation
@ stdcall AllowSetForegroundWindow (long) @ stdcall AllowSetForegroundWindow (long)
......
...@@ -3369,6 +3369,7 @@ WINUSERAPI HKL WINAPI ActivateKeyboardLayout(HKL,UINT); ...@@ -3369,6 +3369,7 @@ WINUSERAPI HKL WINAPI ActivateKeyboardLayout(HKL,UINT);
WINUSERAPI BOOL WINAPI AddClipboardFormatListener(HWND); WINUSERAPI BOOL WINAPI AddClipboardFormatListener(HWND);
WINUSERAPI BOOL WINAPI AdjustWindowRect(LPRECT,DWORD,BOOL); WINUSERAPI BOOL WINAPI AdjustWindowRect(LPRECT,DWORD,BOOL);
WINUSERAPI BOOL WINAPI AdjustWindowRectEx(LPRECT,DWORD,BOOL,DWORD); WINUSERAPI BOOL WINAPI AdjustWindowRectEx(LPRECT,DWORD,BOOL,DWORD);
WINUSERAPI BOOL WINAPI AdjustWindowRectExForDpi(RECT*,DWORD,BOOL,DWORD,UINT);
WINUSERAPI BOOL WINAPI AllowSetForegroundWindow(DWORD); WINUSERAPI BOOL WINAPI AllowSetForegroundWindow(DWORD);
WINUSERAPI BOOL WINAPI AnimateWindow(HWND,DWORD,DWORD); WINUSERAPI BOOL WINAPI AnimateWindow(HWND,DWORD,DWORD);
#define AnsiLowerA CharLowerA #define AnsiLowerA CharLowerA
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment