user32: Forward SystemParametersInfo calls to the user driver first.

This commit is contained in:
Alexandre Julliard 2012-11-15 17:38:21 +01:00
parent 4a8716cf5b
commit 13fbce5627
3 changed files with 66 additions and 124 deletions

View File

@ -73,8 +73,6 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(GetCursorPos);
GET_USER_FUNC(SetCursorPos);
GET_USER_FUNC(ClipCursor);
GET_USER_FUNC(GetScreenSaveActive);
GET_USER_FUNC(SetScreenSaveActive);
GET_USER_FUNC(AcquireClipboard);
GET_USER_FUNC(EmptyClipboard);
GET_USER_FUNC(SetClipboardData);
@ -108,6 +106,7 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(WindowMessage);
GET_USER_FUNC(WindowPosChanging);
GET_USER_FUNC(WindowPosChanged);
GET_USER_FUNC(SystemParametersInfo);
#undef GET_USER_FUNC
}
else driver_load_error = GetLastError();
@ -233,15 +232,6 @@ static BOOL CDECL nulldrv_ClipCursor( LPCRECT clip )
return FALSE;
}
static BOOL CDECL nulldrv_GetScreenSaveActive(void)
{
return FALSE;
}
static void CDECL nulldrv_SetScreenSaveActive( BOOL on )
{
}
static INT CDECL nulldrv_AcquireClipboard( HWND hwnd )
{
return 0;
@ -423,6 +413,11 @@ static void CDECL nulldrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT s
{
}
static BOOL CDECL nulldrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, UINT flags )
{
return FALSE;
}
static USER_DRIVER null_driver =
{
/* keyboard functions */
@ -446,9 +441,6 @@ static USER_DRIVER null_driver =
nulldrv_GetCursorPos,
nulldrv_SetCursorPos,
nulldrv_ClipCursor,
/* screen saver functions */
nulldrv_GetScreenSaveActive,
nulldrv_SetScreenSaveActive,
/* clipboard functions */
nulldrv_AcquireClipboard,
nulldrv_CountClipboardFormats,
@ -484,7 +476,9 @@ static USER_DRIVER null_driver =
nulldrv_UpdateLayeredWindow,
nulldrv_WindowMessage,
nulldrv_WindowPosChanging,
nulldrv_WindowPosChanged
nulldrv_WindowPosChanged,
/* system parameters */
nulldrv_SystemParametersInfo
};
@ -591,16 +585,6 @@ static BOOL CDECL loaderdrv_ClipCursor( LPCRECT clip )
return load_driver()->pClipCursor( clip );
}
static BOOL CDECL loaderdrv_GetScreenSaveActive(void)
{
return load_driver()->pGetScreenSaveActive();
}
static void CDECL loaderdrv_SetScreenSaveActive( BOOL on )
{
load_driver()->pSetScreenSaveActive( on );
}
static INT CDECL loaderdrv_AcquireClipboard( HWND hwnd )
{
return load_driver()->pAcquireClipboard( hwnd );
@ -778,6 +762,11 @@ static void CDECL loaderdrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT
client_rect, visible_rect, valid_rects, surface );
}
static BOOL CDECL loaderdrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, UINT flags )
{
return FALSE; /* don't trigger a driver load */
}
static USER_DRIVER lazy_load_driver =
{
/* keyboard functions */
@ -801,9 +790,6 @@ static USER_DRIVER lazy_load_driver =
loaderdrv_GetCursorPos,
loaderdrv_SetCursorPos,
loaderdrv_ClipCursor,
/* screen saver functions */
loaderdrv_GetScreenSaveActive,
loaderdrv_SetScreenSaveActive,
/* clipboard functions */
loaderdrv_AcquireClipboard,
loaderdrv_CountClipboardFormats,
@ -839,5 +825,7 @@ static USER_DRIVER lazy_load_driver =
loaderdrv_UpdateLayeredWindow,
loaderdrv_WindowMessage,
loaderdrv_WindowPosChanging,
loaderdrv_WindowPosChanged
loaderdrv_WindowPosChanged,
/* system parameters */
loaderdrv_SystemParametersInfo
};

View File

@ -641,14 +641,6 @@ static BOOL SYSPARAMS_SaveRaw( LPCWSTR lpRegKey, LPCWSTR lpValName,
return ret;
}
/* Convenience function to save strings */
static BOOL SYSPARAMS_Save( LPCWSTR lpRegKey, LPCWSTR lpValName, LPCWSTR lpValue,
UINT fWinIni )
{
return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)lpValue,
(strlenW(lpValue) + 1)*sizeof(WCHAR), REG_SZ, fWinIni );
}
/* load a value to a registry entry */
static DWORD load_entry( struct sysparam_entry *entry, void *data, DWORD size )
{
@ -1211,6 +1203,7 @@ static BOOL_ENTRY( LOWPOWERACTIVE, FALSE );
static BOOL_ENTRY( MOUSEBUTTONSWAP, FALSE );
static BOOL_ENTRY( POWEROFFACTIVE, FALSE );
static BOOL_ENTRY( SCREENREADER, FALSE );
static BOOL_ENTRY( SCREENSAVEACTIVE, TRUE );
static BOOL_ENTRY( SCREENSAVERRUNNING, FALSE );
static BOOL_ENTRY( SHOWSOUNDS, FALSE );
static BOOL_ENTRY( SNAPTODEFBUTTON, FALSE );
@ -1321,12 +1314,13 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
#define WINE_SPI_WARN(x) \
case x: \
WARN( "Ignored action: %u (%s)\n", x, #x ); \
ret = TRUE; \
break
BOOL ret = TRUE;
BOOL ret = USER_Driver->pSystemParametersInfo( uiAction, uiParam, pvParam, fWinIni );
unsigned spi_idx = 0;
switch (uiAction)
if (!ret) switch (uiAction)
{
case SPI_GETBEEP:
ret = get_entry( &entry_BEEP, uiParam, pvParam );
@ -1374,25 +1368,12 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
case SPI_SETSCREENSAVETIMEOUT:
ret = set_entry( &entry_SCREENSAVETIMEOUT, uiParam, pvParam, fWinIni );
break;
case SPI_GETSCREENSAVEACTIVE: /* 16 */
if (!pvParam) return FALSE;
*(BOOL *)pvParam = USER_Driver->pGetScreenSaveActive();
case SPI_GETSCREENSAVEACTIVE:
ret = get_entry( &entry_SCREENSAVEACTIVE, uiParam, pvParam );
break;
case SPI_SETSCREENSAVEACTIVE: /* 17 */
{
WCHAR buf[12];
wsprintfW(buf, CSu, uiParam);
USER_Driver->pSetScreenSaveActive( uiParam );
/* saved value does not affect Wine */
SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
SPI_SETSCREENSAVEACTIVE_VALNAME,
buf, fWinIni );
case SPI_SETSCREENSAVEACTIVE:
ret = set_entry( &entry_SCREENSAVEACTIVE, uiParam, pvParam, fWinIni );
break;
}
case SPI_GETGRIDGRANULARITY:
ret = get_entry( &entry_GRIDGRANULARITY, uiParam, pvParam );
break;
@ -1455,6 +1436,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
case SPI_GETFASTTASKSWITCH: /* 35 */
if (!pvParam) return FALSE;
*(BOOL *)pvParam = 1;
ret = TRUE;
break;
case SPI_SETFASTTASKSWITCH: /* 36 */
@ -1474,22 +1456,22 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
if (!pvParam) return FALSE;
get_entry( &entry_BORDER, 0, &lpnm->iBorderWidth );
get_entry( &entry_SCROLLWIDTH, 0, &lpnm->iScrollWidth );
get_entry( &entry_SCROLLHEIGHT, 0, &lpnm->iScrollHeight );
get_entry( &entry_CAPTIONWIDTH, 0, &lpnm->iCaptionWidth );
get_entry( &entry_CAPTIONHEIGHT, 0, &lpnm->iCaptionHeight );
get_entry( &entry_CAPTIONLOGFONT, 0, &lpnm->lfCaptionFont );
get_entry( &entry_SMCAPTIONWIDTH, 0, &lpnm->iSmCaptionWidth );
get_entry( &entry_SMCAPTIONHEIGHT, 0, &lpnm->iSmCaptionHeight );
get_entry( &entry_SMCAPTIONLOGFONT, 0, &lpnm->lfSmCaptionFont );
get_entry( &entry_MENUWIDTH, 0, &lpnm->iMenuWidth );
get_entry( &entry_MENUHEIGHT, 0, &lpnm->iMenuHeight );
get_entry( &entry_MENULOGFONT, 0, &lpnm->lfMenuFont );
get_entry( &entry_STATUSLOGFONT, 0, &lpnm->lfStatusFont );
get_entry( &entry_MESSAGELOGFONT, 0, &lpnm->lfMessageFont );
if (lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
get_entry( &entry_PADDEDBORDERWIDTH, 0, &lpnm->iPaddedBorderWidth );
ret = get_entry( &entry_BORDER, 0, &lpnm->iBorderWidth ) &&
get_entry( &entry_SCROLLWIDTH, 0, &lpnm->iScrollWidth ) &&
get_entry( &entry_SCROLLHEIGHT, 0, &lpnm->iScrollHeight ) &&
get_entry( &entry_CAPTIONWIDTH, 0, &lpnm->iCaptionWidth ) &&
get_entry( &entry_CAPTIONHEIGHT, 0, &lpnm->iCaptionHeight ) &&
get_entry( &entry_CAPTIONLOGFONT, 0, &lpnm->lfCaptionFont ) &&
get_entry( &entry_SMCAPTIONWIDTH, 0, &lpnm->iSmCaptionWidth ) &&
get_entry( &entry_SMCAPTIONHEIGHT, 0, &lpnm->iSmCaptionHeight ) &&
get_entry( &entry_SMCAPTIONLOGFONT, 0, &lpnm->lfSmCaptionFont ) &&
get_entry( &entry_MENUWIDTH, 0, &lpnm->iMenuWidth ) &&
get_entry( &entry_MENUHEIGHT, 0, &lpnm->iMenuHeight ) &&
get_entry( &entry_MENULOGFONT, 0, &lpnm->lfMenuFont ) &&
get_entry( &entry_STATUSLOGFONT, 0, &lpnm->lfStatusFont ) &&
get_entry( &entry_MESSAGELOGFONT, 0, &lpnm->lfMessageFont );
if (ret && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
ret = get_entry( &entry_PADDEDBORDERWIDTH, 0, &lpnm->iPaddedBorderWidth );
normalize_nonclientmetrics( lpnm );
break;
}
@ -1524,16 +1506,15 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
{
MINIMIZEDMETRICS * lpMm = pvParam;
if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
get_entry( &entry_MINWIDTH, 0, &lpMm->iWidth );
get_entry( &entry_MINHORZGAP, 0, &lpMm->iHorzGap );
get_entry( &entry_MINVERTGAP, 0, &lpMm->iVertGap );
get_entry( &entry_MINARRANGE, 0, &lpMm->iArrange );
ret = get_entry( &entry_MINWIDTH, 0, &lpMm->iWidth ) &&
get_entry( &entry_MINHORZGAP, 0, &lpMm->iHorzGap ) &&
get_entry( &entry_MINVERTGAP, 0, &lpMm->iVertGap ) &&
get_entry( &entry_MINARRANGE, 0, &lpMm->iArrange );
lpMm->iWidth = max( 0, lpMm->iWidth );
lpMm->iHorzGap = max( 0, lpMm->iHorzGap );
lpMm->iVertGap = max( 0, lpMm->iVertGap );
lpMm->iArrange &= 0x0f;
} else
ret = FALSE;
}
break;
}
case SPI_SETMINIMIZEDMETRICS:
@ -1544,8 +1525,6 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
set_entry( &entry_MINHORZGAP, max( 0, lpMm->iHorzGap ), NULL, fWinIni ) &&
set_entry( &entry_MINVERTGAP, max( 0, lpMm->iVertGap ), NULL, fWinIni ) &&
set_entry( &entry_MINARRANGE, lpMm->iArrange & 0x0f, NULL, fWinIni );
else
ret = FALSE;
break;
}
case SPI_GETICONMETRICS:
@ -1553,12 +1532,11 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
LPICONMETRICSW lpIcon = pvParam;
if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
{
get_entry( &entry_ICONHORIZONTALSPACING, 0, &lpIcon->iHorzSpacing );
get_entry( &entry_ICONVERTICALSPACING, 0, &lpIcon->iVertSpacing );
get_entry( &entry_ICONTITLEWRAP, 0, &lpIcon->iTitleWrap );
get_entry( &entry_ICONTITLELOGFONT, 0, &lpIcon->lfFont );
ret = get_entry( &entry_ICONHORIZONTALSPACING, 0, &lpIcon->iHorzSpacing ) &&
get_entry( &entry_ICONVERTICALSPACING, 0, &lpIcon->iVertSpacing ) &&
get_entry( &entry_ICONTITLEWRAP, 0, &lpIcon->iTitleWrap ) &&
get_entry( &entry_ICONTITLELOGFONT, 0, &lpIcon->lfFont );
}
else ret = FALSE;
break;
}
case SPI_SETICONMETRICS:
@ -1569,8 +1547,6 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
set_entry( &entry_ICONHORIZONTALSPACING, max(32,lpIcon->iHorzSpacing), NULL, fWinIni ) &&
set_entry( &entry_ICONTITLEWRAP, lpIcon->iTitleWrap, NULL, fWinIni ) &&
set_entry( &entry_ICONTITLELOGFONT, 0, &lpIcon->lfFont, fWinIni );
else
ret = FALSE;
break;
}
@ -1581,6 +1557,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
spi_idx = SPI_SETWORKAREA_IDX;
CopyRect( &work_area, pvParam );
spi_loaded[spi_idx] = TRUE;
ret = TRUE;
break;
}
@ -1598,6 +1575,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
spi_loaded[spi_idx] = TRUE;
}
CopyRect( pvParam, &work_area );
ret = TRUE;
TRACE("work area %s\n", wine_dbgstr_rect( &work_area ));
break;
}
@ -1616,10 +1594,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
lpFilterKeys->iDelayMSec = 0;
lpFilterKeys->iRepeatMSec = 0;
lpFilterKeys->iBounceMSec = 0;
}
else
{
ret = FALSE;
ret = TRUE;
}
break;
}
@ -1633,10 +1608,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
{
/* Indicate that no ToggleKeys feature available */
lpToggleKeys->dwFlags = 0;
}
else
{
ret = FALSE;
ret = TRUE;
}
break;
}
@ -1655,10 +1627,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
lpMouseKeys->iCtrlSpeed = 0;
lpMouseKeys->dwReserved1 = 0;
lpMouseKeys->dwReserved2 = 0;
}
else
{
ret = FALSE;
ret = TRUE;
}
break;
}
@ -1679,10 +1648,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
{
/* Indicate that no StickyKeys feature available */
lpStickyKeys->dwFlags = 0;
}
else
{
ret = FALSE;
ret = TRUE;
}
break;
}
@ -1697,10 +1663,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
/* Indicate that no accessibility features timeout is available */
lpAccessTimeout->dwFlags = 0;
lpAccessTimeout->iTimeOutMSec = 0;
}
else
{
ret = FALSE;
ret = TRUE;
}
break;
}
@ -1718,10 +1681,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
lpSerialKeysW->lpszPort = NULL;
lpSerialKeysW->iBaudRate = 0;
lpSerialKeysW->iPortState = 0;
}
else
{
ret = FALSE;
ret = TRUE;
}
break;
}
@ -1745,10 +1705,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
lpSoundSentryW->iWindowsEffectMSec = 0;
lpSoundSentryW->lpszWindowsEffectDLL = 0;
lpSoundSentryW->iWindowsEffectOrdinal = 0;
}
else
{
ret = FALSE;
ret = TRUE;
}
break;
}
@ -1763,10 +1720,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
/* Indicate that no high contrast feature available */
lpHighContrastW->dwFlags = 0;
lpHighContrastW->lpszDefaultScheme = NULL;
}
else
{
ret = FALSE;
ret = TRUE;
}
break;
}
@ -1791,9 +1745,10 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
/* Tell it "disabled" */
if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
{
lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
else
ret = FALSE;
ret = TRUE;
}
break;
}
WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */

View File

@ -79,9 +79,6 @@ typedef struct tagUSER_DRIVER {
BOOL (CDECL *pGetCursorPos)(LPPOINT);
BOOL (CDECL *pSetCursorPos)(INT,INT);
BOOL (CDECL *pClipCursor)(LPCRECT);
/* screen saver functions */
BOOL (CDECL *pGetScreenSaveActive)(void);
void (CDECL *pSetScreenSaveActive)(BOOL);
/* clipboard functions */
INT (CDECL *pAcquireClipboard)(HWND); /* Acquire selection */
BOOL (CDECL *pCountClipboardFormats)(void); /* Count available clipboard formats */
@ -118,6 +115,8 @@ typedef struct tagUSER_DRIVER {
LRESULT (CDECL *pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
void (CDECL *pWindowPosChanging)(HWND,HWND,UINT,const RECT *,const RECT *,RECT *,struct window_surface**);
void (CDECL *pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *,const RECT *,struct window_surface*);
/* system parameters */
BOOL (CDECL *pSystemParametersInfo)(UINT,UINT,void*,UINT);
} USER_DRIVER;
extern const USER_DRIVER *USER_Driver DECLSPEC_HIDDEN;