- move wallpaper info from WINSTATION_OBJECT to SPIVALUES. Also remove some unused fields from WINSTATION_OBJECT

svn path=/trunk/; revision=55862
This commit is contained in:
Giannis Adamopoulos 2012-02-25 20:06:15 +00:00
parent f1838c9108
commit 23c1c259f0
4 changed files with 39 additions and 46 deletions

View file

@ -34,6 +34,13 @@ typedef enum _USERPREFMASKS
UPM_DEFAULT = 0x80003E9E UPM_DEFAULT = 0x80003E9E
} USERPREFMASKS; } USERPREFMASKS;
typedef enum
{
wmCenter = 0,
wmTile,
wmStretch
} WALLPAPER_MODE;
typedef struct _SPIVALUES typedef struct _SPIVALUES
{ {
/* Metrics */ /* Metrics */
@ -129,11 +136,16 @@ typedef struct _SPIVALUES
TEXTMETRICW tmMenuFont; TEXTMETRICW tmMenuFont;
TEXTMETRICW tmCaptionFont; TEXTMETRICW tmCaptionFont;
/* Wallpaper */
HANDLE hbmWallpaper;
ULONG cxWallpaper, cyWallpaper;
WALLPAPER_MODE WallpaperMode;
UNICODE_STRING ustrWallpaper;
WCHAR awcWallpaper[MAX_PATH];
BOOL bHandHeld; BOOL bHandHeld;
BOOL bFastTaskSwitch; BOOL bFastTaskSwitch;
UINT uiGridGranularity; UINT uiGridGranularity;
UNICODE_STRING ustrWallpaper;
WCHAR awcWallpaper[MAX_PATH];
ANIMATIONINFO animationinfo; ANIMATIONINFO animationinfo;
BOOL bSnapToDefBtn; BOOL bSnapToDefBtn;

View file

@ -7,19 +7,8 @@
#define WSS_LOCKED (1) #define WSS_LOCKED (1)
#define WSS_NOINTERACTIVE (2) #define WSS_NOINTERACTIVE (2)
typedef enum
{
wmCenter = 0,
wmTile,
wmStretch
} WALLPAPER_MODE;
typedef struct _WINSTATION_OBJECT typedef struct _WINSTATION_OBJECT
{ {
PVOID SharedHeap; /* Points to kmode memory! */
CSHORT Type;
CSHORT Size;
KSPIN_LOCK Lock; KSPIN_LOCK Lock;
UNICODE_STRING Name; UNICODE_STRING Name;
LIST_ENTRY DesktopListHead; LIST_ENTRY DesktopListHead;
@ -28,11 +17,6 @@ typedef struct _WINSTATION_OBJECT
HANDLE ShellWindow; HANDLE ShellWindow;
HANDLE ShellListView; HANDLE ShellListView;
/* Wallpaper */
HANDLE hbmWallpaper;
ULONG cxWallpaper, cyWallpaper;
WALLPAPER_MODE WallpaperMode;
ULONG Flags; ULONG Flags;
struct _DESKTOP* ActiveDesktop; struct _DESKTOP* ActiveDesktop;

View file

@ -1238,8 +1238,6 @@ NtUserPaintDesktop(HDC hDC)
COLORREF color_old; COLORREF color_old;
UINT align_old; UINT align_old;
int mode_old; int mode_old;
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
PWINSTATION_OBJECT WinSta = pti->rpdesk->rpwinstaParent;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
UserEnterExclusive(); UserEnterExclusive();
@ -1262,7 +1260,7 @@ NtUserPaintDesktop(HDC hDC)
/* /*
* Paint desktop background * Paint desktop background
*/ */
if (WinSta->hbmWallpaper != NULL) if (gspv.hbmWallpaper != NULL)
{ {
SIZE sz; SIZE sz;
int x, y; int x, y;
@ -1271,8 +1269,8 @@ NtUserPaintDesktop(HDC hDC)
sz.cx = WndDesktop->rcWindow.right - WndDesktop->rcWindow.left; sz.cx = WndDesktop->rcWindow.right - WndDesktop->rcWindow.left;
sz.cy = WndDesktop->rcWindow.bottom - WndDesktop->rcWindow.top; sz.cy = WndDesktop->rcWindow.bottom - WndDesktop->rcWindow.top;
if (WinSta->WallpaperMode == wmStretch || if (gspv.WallpaperMode == wmStretch ||
WinSta->WallpaperMode == wmTile) gspv.WallpaperMode == wmTile)
{ {
x = 0; x = 0;
y = 0; y = 0;
@ -1280,8 +1278,8 @@ NtUserPaintDesktop(HDC hDC)
else else
{ {
/* Find the upper left corner, can be negtive if the bitmap is bigger then the screen */ /* Find the upper left corner, can be negtive if the bitmap is bigger then the screen */
x = (sz.cx / 2) - (WinSta->cxWallpaper / 2); x = (sz.cx / 2) - (gspv.cxWallpaper / 2);
y = (sz.cy / 2) - (WinSta->cyWallpaper / 2); y = (sz.cy / 2) - (gspv.cyWallpaper / 2);
} }
hWallpaperDC = NtGdiCreateCompatibleDC(hDC); hWallpaperDC = NtGdiCreateCompatibleDC(hDC);
@ -1303,9 +1301,9 @@ NtUserPaintDesktop(HDC hDC)
/*Do not fill the background after it is painted no matter the size of the picture */ /*Do not fill the background after it is painted no matter the size of the picture */
doPatBlt = FALSE; doPatBlt = FALSE;
hOldBitmap = NtGdiSelectBitmap(hWallpaperDC, WinSta->hbmWallpaper); hOldBitmap = NtGdiSelectBitmap(hWallpaperDC, gspv.hbmWallpaper);
if (WinSta->WallpaperMode == wmStretch) if (gspv.WallpaperMode == wmStretch)
{ {
if(Rect.right && Rect.bottom) if(Rect.right && Rect.bottom)
NtGdiStretchBlt(hDC, NtGdiStretchBlt(hDC,
@ -1316,24 +1314,24 @@ NtUserPaintDesktop(HDC hDC)
hWallpaperDC, hWallpaperDC,
0, 0,
0, 0,
WinSta->cxWallpaper, gspv.cxWallpaper,
WinSta->cyWallpaper, gspv.cyWallpaper,
SRCCOPY, SRCCOPY,
0); 0);
} }
else if (WinSta->WallpaperMode == wmTile) else if (gspv.WallpaperMode == wmTile)
{ {
/* Paint the bitmap across the screen then down */ /* Paint the bitmap across the screen then down */
for(y = 0; y < Rect.bottom; y += WinSta->cyWallpaper) for(y = 0; y < Rect.bottom; y += gspv.cyWallpaper)
{ {
for(x = 0; x < Rect.right; x += WinSta->cxWallpaper) for(x = 0; x < Rect.right; x += gspv.cxWallpaper)
{ {
NtGdiBitBlt(hDC, NtGdiBitBlt(hDC,
x, x,
y, y,
WinSta->cxWallpaper, gspv.cxWallpaper,
WinSta->cyWallpaper, gspv.cyWallpaper,
hWallpaperDC, hWallpaperDC,
0, 0,
0, 0,
@ -1348,8 +1346,8 @@ NtUserPaintDesktop(HDC hDC)
NtGdiBitBlt(hDC, NtGdiBitBlt(hDC,
x, x,
y, y,
WinSta->cxWallpaper, gspv.cxWallpaper,
WinSta->cyWallpaper, gspv.cyWallpaper,
hWallpaperDC, hWallpaperDC,
0, 0,
0, 0,

View file

@ -592,7 +592,6 @@ SpiSetWallpaper(PVOID pvParam, FLONG fl)
HBITMAP hbmp, hOldBitmap; HBITMAP hbmp, hOldBitmap;
SURFACE *psurfBmp; SURFACE *psurfBmp;
ULONG ulTile, ulStyle; ULONG ulTile, ulStyle;
PWINSTATION_OBJECT gpwinstaCurrent = GetW32ProcessInfo()->prpwinsta;
REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION); REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
@ -654,9 +653,9 @@ SpiSetWallpaper(PVOID pvParam, FLONG fl)
return 0; return 0;
} }
gpwinstaCurrent->cxWallpaper = psurfBmp->SurfObj.sizlBitmap.cx; gspv.cxWallpaper = psurfBmp->SurfObj.sizlBitmap.cx;
gpwinstaCurrent->cyWallpaper = psurfBmp->SurfObj.sizlBitmap.cy; gspv.cyWallpaper = psurfBmp->SurfObj.sizlBitmap.cy;
gpwinstaCurrent->WallpaperMode = wmCenter; gspv.WallpaperMode = wmCenter;
SURFACE_ShareUnlockSurface(psurfBmp); SURFACE_ShareUnlockSurface(psurfBmp);
@ -671,23 +670,23 @@ SpiSetWallpaper(PVOID pvParam, FLONG fl)
/* Check the values we found in the registry */ /* Check the values we found in the registry */
if(ulTile && !ulStyle) if(ulTile && !ulStyle)
{ {
gpwinstaCurrent->WallpaperMode = wmTile; gspv.WallpaperMode = wmTile;
} }
else if(!ulTile && ulStyle == 2) else if(!ulTile && ulStyle == 2)
{ {
gpwinstaCurrent->WallpaperMode = wmStretch; gspv.WallpaperMode = wmStretch;
} }
} }
else else
{ {
/* Remove wallpaper */ /* Remove wallpaper */
gpwinstaCurrent->cxWallpaper = 0; gspv.cxWallpaper = 0;
gpwinstaCurrent->cyWallpaper = 0; gspv.cyWallpaper = 0;
hbmp = 0; hbmp = 0;
} }
/* Take care of the old wallpaper, if any */ /* Take care of the old wallpaper, if any */
hOldBitmap = gpwinstaCurrent->hbmWallpaper; hOldBitmap = gspv.hbmWallpaper;
if(hOldBitmap != NULL) if(hOldBitmap != NULL)
{ {
/* Delete the old wallpaper */ /* Delete the old wallpaper */
@ -696,7 +695,7 @@ SpiSetWallpaper(PVOID pvParam, FLONG fl)
} }
/* Set the new wallpaper */ /* Set the new wallpaper */
gpwinstaCurrent->hbmWallpaper = hbmp; gspv.hbmWallpaper = hbmp;
NtUserRedrawWindow(UserGetShellWindow(), NULL, NULL, RDW_INVALIDATE | RDW_ERASE); NtUserRedrawWindow(UserGetShellWindow(), NULL, NULL, RDW_INVALIDATE | RDW_ERASE);