user32: Add support for iPaddedBorderWidth in NONCLIENTMETRICS.

This commit is contained in:
Dmitry Timoshkov 2011-10-08 20:11:34 +09:00 committed by Alexandre Julliard
parent 0cae7c5087
commit 70caadbf34
5 changed files with 78 additions and 27 deletions

View file

@ -369,7 +369,8 @@ static NONCLIENTMETRICSW nonclient_metrics =
18, /* iMenuHeight */
{ 0 }, /* lfMenuFont */
{ 0 }, /* lfStatusFont */
{ 0 } /* lfMessageFont */
{ 0 }, /* lfMessageFont */
0 /* iPaddedBorderWidth */
};
/* some additional non client metric info */
@ -462,6 +463,10 @@ static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW* lpnm32W
SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMenuFont, &lpnm32A->lfMenuFont );
SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfStatusFont, &lpnm32A->lfStatusFont );
SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMessageFont, &lpnm32A->lfMessageFont );
if (lpnm32A->cbSize == sizeof(NONCLIENTMETRICSA) && lpnm32W->cbSize == sizeof(NONCLIENTMETRICSW))
lpnm32A->iPaddedBorderWidth = lpnm32W->iPaddedBorderWidth;
else
lpnm32A->iPaddedBorderWidth = 0;
}
static void SYSPARAMS_NonClientMetrics32ATo32W( const NONCLIENTMETRICSA* lpnm32A, LPNONCLIENTMETRICSW lpnm32W )
@ -480,6 +485,10 @@ static void SYSPARAMS_NonClientMetrics32ATo32W( const NONCLIENTMETRICSA* lpnm32A
SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMenuFont, &lpnm32W->lfMenuFont );
SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfStatusFont, &lpnm32W->lfStatusFont );
SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMessageFont, &lpnm32W->lfMessageFont );
if (lpnm32A->cbSize == sizeof(NONCLIENTMETRICSA) && lpnm32W->cbSize == sizeof(NONCLIENTMETRICSW))
lpnm32W->iPaddedBorderWidth = lpnm32A->iPaddedBorderWidth;
else
lpnm32W->iPaddedBorderWidth = 0;
}
@ -1569,7 +1578,8 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
if (lpnm && (lpnm->cbSize == sizeof(NONCLIENTMETRICSW) ||
lpnm->cbSize == FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth)))
*lpnm = nonclient_metrics;
else
ret = FALSE;
@ -1580,7 +1590,8 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
{
LPNONCLIENTMETRICSW lpnm = pvParam;
if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
if (lpnm && (lpnm->cbSize == sizeof(NONCLIENTMETRICSW) ||
lpnm->cbSize == FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth)))
{
NONCLIENTMETRICSW ncm;
ret = set_uint_param( SPI_SETBORDER_IDX,
@ -1626,7 +1637,10 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME,
&lpnm->lfMessageFont, fWinIni);
if( ret) {
ncm = *lpnm;
memcpy(&ncm, lpnm, FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth));
ncm.cbSize = sizeof(ncm);
ncm.iPaddedBorderWidth = (lpnm->cbSize == sizeof(NONCLIENTMETRICSW)) ?
lpnm->iPaddedBorderWidth : 0;
normalize_nonclientmetrics( &ncm);
nonclient_metrics = ncm;
spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
@ -2526,7 +2540,8 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
{
NONCLIENTMETRICSW tmp;
LPNONCLIENTMETRICSA lpnmA = pvParam;
if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
if (lpnmA && (lpnmA->cbSize == sizeof(NONCLIENTMETRICSA) ||
lpnmA->cbSize == FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth)))
{
tmp.cbSize = sizeof(NONCLIENTMETRICSW);
ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
@ -2542,7 +2557,8 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
{
NONCLIENTMETRICSW tmp;
LPNONCLIENTMETRICSA lpnmA = pvParam;
if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
if (lpnmA && (lpnmA->cbSize == sizeof(NONCLIENTMETRICSA) ||
lpnmA->cbSize == FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth)))
{
tmp.cbSize = sizeof(NONCLIENTMETRICSW);
SYSPARAMS_NonClientMetrics32ATo32W( lpnmA, &tmp );

View file

@ -1198,7 +1198,7 @@ static void test_MessageBoxFontTest(void)
}
GetObjectW(hFont, sizeof(LOGFONTW), &lfStaticFont);
ncMetrics.cbSize = sizeof(NONCLIENTMETRICSW);
ncMetrics.cbSize = FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth);
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncMetrics, 0);
ok( !memcmp(&lfStaticFont, &ncMetrics.lfMessageFont, FIELD_OFFSET(LOGFONTW, lfFaceName)) &&
!lstrcmpW(lfStaticFont.lfFaceName, ncMetrics.lfMessageFont.lfFaceName),

View file

@ -1562,7 +1562,7 @@ static void test_pack_LPNONCLIENTMETRICSA(void)
/* LPNONCLIENTMETRICSA */
TEST_TYPE_SIZE (LPNONCLIENTMETRICSA, 8)
TEST_TYPE_ALIGN (LPNONCLIENTMETRICSA, 8)
TEST_TARGET_SIZE (LPNONCLIENTMETRICSA, 340)
TEST_TARGET_SIZE (LPNONCLIENTMETRICSA, 344)
TEST_TARGET_ALIGN(LPNONCLIENTMETRICSA, 4)
}
@ -1571,7 +1571,7 @@ static void test_pack_LPNONCLIENTMETRICSW(void)
/* LPNONCLIENTMETRICSW */
TEST_TYPE_SIZE (LPNONCLIENTMETRICSW, 8)
TEST_TYPE_ALIGN (LPNONCLIENTMETRICSW, 8)
TEST_TARGET_SIZE (LPNONCLIENTMETRICSW, 500)
TEST_TARGET_SIZE (LPNONCLIENTMETRICSW, 504)
TEST_TARGET_ALIGN(LPNONCLIENTMETRICSW, 4)
}
@ -2390,7 +2390,7 @@ static void test_pack_NMHDR(void)
static void test_pack_NONCLIENTMETRICSA(void)
{
/* NONCLIENTMETRICSA */
TEST_TYPE_SIZE (NONCLIENTMETRICSA, 340)
TEST_TYPE_SIZE (NONCLIENTMETRICSA, 344)
TEST_TYPE_ALIGN (NONCLIENTMETRICSA, 4)
TEST_FIELD_SIZE (NONCLIENTMETRICSA, cbSize, 4)
TEST_FIELD_ALIGN (NONCLIENTMETRICSA, cbSize, 4)
@ -2437,12 +2437,15 @@ static void test_pack_NONCLIENTMETRICSA(void)
TEST_FIELD_SIZE (NONCLIENTMETRICSA, lfMessageFont, 60)
TEST_FIELD_ALIGN (NONCLIENTMETRICSA, lfMessageFont, 4)
TEST_FIELD_OFFSET(NONCLIENTMETRICSA, lfMessageFont, 280)
TEST_FIELD_SIZE (NONCLIENTMETRICSA, iPaddedBorderWidth, 4)
TEST_FIELD_ALIGN (NONCLIENTMETRICSA, iPaddedBorderWidth, 4)
TEST_FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth, 340)
}
static void test_pack_NONCLIENTMETRICSW(void)
{
/* NONCLIENTMETRICSW */
TEST_TYPE_SIZE (NONCLIENTMETRICSW, 500)
TEST_TYPE_SIZE (NONCLIENTMETRICSW, 504)
TEST_TYPE_ALIGN (NONCLIENTMETRICSW, 4)
TEST_FIELD_SIZE (NONCLIENTMETRICSW, cbSize, 4)
TEST_FIELD_ALIGN (NONCLIENTMETRICSW, cbSize, 4)
@ -2489,6 +2492,9 @@ static void test_pack_NONCLIENTMETRICSW(void)
TEST_FIELD_SIZE (NONCLIENTMETRICSW, lfMessageFont, 92)
TEST_FIELD_ALIGN (NONCLIENTMETRICSW, lfMessageFont, 4)
TEST_FIELD_OFFSET(NONCLIENTMETRICSW, lfMessageFont, 408)
TEST_FIELD_SIZE (NONCLIENTMETRICSW, iPaddedBorderWidth, 4)
TEST_FIELD_ALIGN (NONCLIENTMETRICSW, iPaddedBorderWidth, 4)
TEST_FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth, 500)
}
static void test_pack_PAINTSTRUCT(void)
@ -2870,7 +2876,7 @@ static void test_pack_PNONCLIENTMETRICSA(void)
/* PNONCLIENTMETRICSA */
TEST_TYPE_SIZE (PNONCLIENTMETRICSA, 8)
TEST_TYPE_ALIGN (PNONCLIENTMETRICSA, 8)
TEST_TARGET_SIZE (PNONCLIENTMETRICSA, 340)
TEST_TARGET_SIZE (PNONCLIENTMETRICSA, 344)
TEST_TARGET_ALIGN(PNONCLIENTMETRICSA, 4)
}
@ -2879,7 +2885,7 @@ static void test_pack_PNONCLIENTMETRICSW(void)
/* PNONCLIENTMETRICSW */
TEST_TYPE_SIZE (PNONCLIENTMETRICSW, 8)
TEST_TYPE_ALIGN (PNONCLIENTMETRICSW, 8)
TEST_TARGET_SIZE (PNONCLIENTMETRICSW, 500)
TEST_TARGET_SIZE (PNONCLIENTMETRICSW, 504)
TEST_TARGET_ALIGN(PNONCLIENTMETRICSW, 4)
}
@ -5060,7 +5066,7 @@ static void test_pack_LPNONCLIENTMETRICSA(void)
/* LPNONCLIENTMETRICSA */
TEST_TYPE_SIZE (LPNONCLIENTMETRICSA, 4)
TEST_TYPE_ALIGN (LPNONCLIENTMETRICSA, 4)
TEST_TARGET_SIZE (LPNONCLIENTMETRICSA, 340)
TEST_TARGET_SIZE (LPNONCLIENTMETRICSA, 344)
TEST_TARGET_ALIGN(LPNONCLIENTMETRICSA, 4)
}
@ -5069,7 +5075,7 @@ static void test_pack_LPNONCLIENTMETRICSW(void)
/* LPNONCLIENTMETRICSW */
TEST_TYPE_SIZE (LPNONCLIENTMETRICSW, 4)
TEST_TYPE_ALIGN (LPNONCLIENTMETRICSW, 4)
TEST_TARGET_SIZE (LPNONCLIENTMETRICSW, 500)
TEST_TARGET_SIZE (LPNONCLIENTMETRICSW, 504)
TEST_TARGET_ALIGN(LPNONCLIENTMETRICSW, 4)
}
@ -5888,7 +5894,7 @@ static void test_pack_NMHDR(void)
static void test_pack_NONCLIENTMETRICSA(void)
{
/* NONCLIENTMETRICSA */
TEST_TYPE_SIZE (NONCLIENTMETRICSA, 340)
TEST_TYPE_SIZE (NONCLIENTMETRICSA, 344)
TEST_TYPE_ALIGN (NONCLIENTMETRICSA, 4)
TEST_FIELD_SIZE (NONCLIENTMETRICSA, cbSize, 4)
TEST_FIELD_ALIGN (NONCLIENTMETRICSA, cbSize, 4)
@ -5935,12 +5941,15 @@ static void test_pack_NONCLIENTMETRICSA(void)
TEST_FIELD_SIZE (NONCLIENTMETRICSA, lfMessageFont, 60)
TEST_FIELD_ALIGN (NONCLIENTMETRICSA, lfMessageFont, 4)
TEST_FIELD_OFFSET(NONCLIENTMETRICSA, lfMessageFont, 280)
TEST_FIELD_SIZE (NONCLIENTMETRICSA, iPaddedBorderWidth, 4)
TEST_FIELD_ALIGN (NONCLIENTMETRICSA, iPaddedBorderWidth, 4)
TEST_FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth, 340)
}
static void test_pack_NONCLIENTMETRICSW(void)
{
/* NONCLIENTMETRICSW */
TEST_TYPE_SIZE (NONCLIENTMETRICSW, 500)
TEST_TYPE_SIZE (NONCLIENTMETRICSW, 504)
TEST_TYPE_ALIGN (NONCLIENTMETRICSW, 4)
TEST_FIELD_SIZE (NONCLIENTMETRICSW, cbSize, 4)
TEST_FIELD_ALIGN (NONCLIENTMETRICSW, cbSize, 4)
@ -5987,6 +5996,9 @@ static void test_pack_NONCLIENTMETRICSW(void)
TEST_FIELD_SIZE (NONCLIENTMETRICSW, lfMessageFont, 92)
TEST_FIELD_ALIGN (NONCLIENTMETRICSW, lfMessageFont, 4)
TEST_FIELD_OFFSET(NONCLIENTMETRICSW, lfMessageFont, 408)
TEST_FIELD_SIZE (NONCLIENTMETRICSW, iPaddedBorderWidth, 4)
TEST_FIELD_ALIGN (NONCLIENTMETRICSW, iPaddedBorderWidth, 4)
TEST_FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth, 500)
}
static void test_pack_PAINTSTRUCT(void)
@ -6368,7 +6380,7 @@ static void test_pack_PNONCLIENTMETRICSA(void)
/* PNONCLIENTMETRICSA */
TEST_TYPE_SIZE (PNONCLIENTMETRICSA, 4)
TEST_TYPE_ALIGN (PNONCLIENTMETRICSA, 4)
TEST_TARGET_SIZE (PNONCLIENTMETRICSA, 340)
TEST_TARGET_SIZE (PNONCLIENTMETRICSA, 344)
TEST_TARGET_ALIGN(PNONCLIENTMETRICSA, 4)
}
@ -6377,7 +6389,7 @@ static void test_pack_PNONCLIENTMETRICSW(void)
/* PNONCLIENTMETRICSW */
TEST_TYPE_SIZE (PNONCLIENTMETRICSW, 4)
TEST_TYPE_ALIGN (PNONCLIENTMETRICSW, 4)
TEST_TARGET_SIZE (PNONCLIENTMETRICSW, 500)
TEST_TARGET_SIZE (PNONCLIENTMETRICSW, 504)
TEST_TARGET_ALIGN(PNONCLIENTMETRICSW, 4)
}

View file

@ -25,6 +25,7 @@
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600 /* For SPI_GETMOUSEHOVERWIDTH and more */
#define _WIN32_IE 0x0700
#define WINVER 0x0600 /* For COLOR_MENUBAR, NONCLIENTMETRICS with padding */
#include "wine/test.h"
#include "windef.h"
@ -682,7 +683,7 @@ static BOOL test_setborder(UINT curr_val, int usesetborder, int dpi)
INT frame;
NONCLIENTMETRICSA ncm;
ncm.cbSize = sizeof( ncm);
ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth);
rc=SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,GetLastError());
if( usesetborder) {
@ -727,11 +728,11 @@ static void test_SPI_SETBORDER( void ) /* 6 */
{
BOOL rc;
UINT old_border;
NONCLIENTMETRICSA ncmsave;
NONCLIENTMETRICS ncmsave;
INT CaptionWidth,
PaddedBorderWidth;
ncmsave.cbSize = sizeof( ncmsave);
ncmsave.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth);
rc=SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncmsave, 0);
if( !rc) {
win_skip("SPI_GETNONCLIENTMETRICS is not available\n");
@ -1415,10 +1416,10 @@ static void test_SPI_SETNONCLIENTMETRICS( void ) /* 44 */
NONCLIENTMETRICSA Ncmcur;
NONCLIENTMETRICSA Ncmstart;
Ncmorig.cbSize = sizeof(NONCLIENTMETRICSA);
Ncmnew.cbSize = sizeof(NONCLIENTMETRICSA);
Ncmcur.cbSize = sizeof(NONCLIENTMETRICSA);
Ncmstart.cbSize = sizeof(NONCLIENTMETRICSA);
Ncmorig.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth);
Ncmnew.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth);
Ncmcur.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth);
Ncmstart.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth);
trace("testing SPI_{GET,SET}NONCLIENTMETRICS\n");
change_counter = 0;
@ -2574,8 +2575,28 @@ static void test_GetSystemMetrics( void)
NONCLIENTMETRICS ncm;
SIZE screen;
assert(sizeof(ncm) == 344);
ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth);
rc = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
ok(rc, "SystemParametersInfoA failed\n");
ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth) - 1;
rc = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
ok(!rc, "SystemParametersInfoA should fail\n");
ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth) + 1;
SetLastError(0xdeadbeef);
rc = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
ok(!rc, "SystemParametersInfoA should fail\n");
ncm.cbSize = sizeof(ncm); /* Vista added padding */
SetLastError(0xdeadbeef);
rc = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
ok(rc || broken(!rc) /* before Vista */, "SystemParametersInfoA failed\n");
minim.cbSize = sizeof( minim);
ncm.cbSize = sizeof( ncm);
ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, iPaddedBorderWidth);
SystemParametersInfo( SPI_GETMINIMIZEDMETRICS, 0, &minim, 0);
rc = SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
if( !rc) {

View file

@ -3230,6 +3230,7 @@ typedef struct tagNONCLIENTMETRICSA {
LOGFONTA lfMenuFont;
LOGFONTA lfStatusFont;
LOGFONTA lfMessageFont;
INT iPaddedBorderWidth;
} NONCLIENTMETRICSA, *PNONCLIENTMETRICSA, *LPNONCLIENTMETRICSA;
typedef struct tagNONCLIENTMETRICSW {
@ -3248,6 +3249,7 @@ typedef struct tagNONCLIENTMETRICSW {
LOGFONTW lfMenuFont;
LOGFONTW lfStatusFont;
LOGFONTW lfMessageFont;
INT iPaddedBorderWidth;
} NONCLIENTMETRICSW, *PNONCLIENTMETRICSW, *LPNONCLIENTMETRICSW;
DECL_WINELIB_TYPE_AW(NONCLIENTMETRICS)