Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b2fa004e
Commit
b2fa004e
authored
Nov 15, 2012
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Simplify initialization of the desktop wallpaper.
parent
4d653b77
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
67 deletions
+30
-67
desktop.c
dlls/user32/desktop.c
+30
-66
desktop.c
programs/explorer/desktop.c
+0
-1
No files found.
dlls/user32/desktop.c
View file @
b2fa004e
...
...
@@ -55,59 +55,44 @@ const struct builtin_class_descr DESKTOP_builtin_class =
/***********************************************************************
* DESKTOP_LoadBitmap
*
* Load a bitmap from a file. Used by SetDeskWallPaper().
*/
static
HBITMAP
DESKTOP_LoadBitmap
(
HDC
hdc
,
const
char
*
filename
)
static
HBITMAP
DESKTOP_LoadBitmap
(
void
)
{
BITMAPFILEHEADER
*
fileHeader
;
BITMAPINFO
*
bitmapInfo
;
HBITMAP
hbitmap
;
HFILE
file
;
LPSTR
buffer
;
LONG
size
;
/* Read all the file into memory */
WCHAR
filename
[
MAX_PATH
];
if
((
file
=
_lopen
(
filename
,
OF_READ
))
==
HFILE_ERROR
)
if
(
!
SystemParametersInfoW
(
SPI_GETDESKWALLPAPER
,
MAX_PATH
,
filename
,
0
))
return
0
;
if
(
!
filename
[
0
])
return
0
;
hbitmap
=
LoadImageW
(
0
,
filename
,
IMAGE_BITMAP
,
0
,
0
,
LR_CREATEDIBSECTION
|
LR_LOADFROMFILE
);
if
(
!
hbitmap
)
{
UINT
len
=
GetWindowsDirectoryA
(
NULL
,
0
);
if
(
!
(
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
strlen
(
filename
)
+
2
)))
return
0
;
GetWindowsDirectoryA
(
buffer
,
len
+
1
);
strcat
(
buffer
,
"
\\
"
);
strcat
(
buffer
,
filename
);
file
=
_lopen
(
buffer
,
OF_READ
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
WCHAR
buffer
[
MAX_PATH
];
UINT
len
=
GetWindowsDirectoryW
(
buffer
,
MAX_PATH
-
2
);
if
(
buffer
[
len
-
1
]
!=
'\\'
)
buffer
[
len
++
]
=
'\\'
;
lstrcpynW
(
buffer
+
len
,
filename
,
MAX_PATH
-
len
);
hbitmap
=
LoadImageW
(
0
,
buffer
,
IMAGE_BITMAP
,
0
,
0
,
LR_CREATEDIBSECTION
|
LR_LOADFROMFILE
);
}
if
(
file
==
HFILE_ERROR
)
return
0
;
size
=
_llseek
(
file
,
0
,
2
);
if
(
!
(
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
{
_lclose
(
file
);
return
0
;
}
_llseek
(
file
,
0
,
0
);
size
=
_lread
(
file
,
buffer
,
size
);
_lclose
(
file
);
fileHeader
=
(
BITMAPFILEHEADER
*
)
buffer
;
bitmapInfo
=
(
BITMAPINFO
*
)(
buffer
+
sizeof
(
BITMAPFILEHEADER
));
/* Check header content */
if
((
fileHeader
->
bfType
!=
0x4d42
)
||
(
size
<
fileHeader
->
bfSize
))
{
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
0
;
}
hbitmap
=
CreateDIBitmap
(
hdc
,
&
bitmapInfo
->
bmiHeader
,
CBM_INIT
,
buffer
+
fileHeader
->
bfOffBits
,
bitmapInfo
,
DIB_RGB_COLORS
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
hbitmap
;
}
/***********************************************************************
* init_wallpaper
*/
static
void
init_wallpaper
(
void
)
{
HBITMAP
hbitmap
=
DESKTOP_LoadBitmap
();
if
(
hbitmapWallPaper
)
DeleteObject
(
hbitmapWallPaper
);
hbitmapWallPaper
=
hbitmap
;
if
(
hbitmap
)
{
BITMAP
bmp
;
GetObjectA
(
hbitmap
,
sizeof
(
bmp
),
&
bmp
);
bitmapSize
.
cx
=
(
bmp
.
bmWidth
!=
0
)
?
bmp
.
bmWidth
:
1
;
bitmapSize
.
cy
=
(
bmp
.
bmHeight
!=
0
)
?
bmp
.
bmHeight
:
1
;
fTileWallPaper
=
GetProfileIntA
(
"desktop"
,
"TileWallPaper"
,
0
);
}
}
/***********************************************************************
* DesktopWndProc
...
...
@@ -182,29 +167,7 @@ BOOL WINAPI PaintDesktop(HDC hdc)
*/
BOOL
WINAPI
SetDeskWallPaper
(
LPCSTR
filename
)
{
HBITMAP
hbitmap
;
HDC
hdc
;
char
buffer
[
256
];
if
(
filename
==
(
LPSTR
)
-
1
)
{
GetProfileStringA
(
"desktop"
,
"WallPaper"
,
"(None)"
,
buffer
,
256
);
filename
=
buffer
;
}
hdc
=
GetDC
(
0
);
hbitmap
=
DESKTOP_LoadBitmap
(
hdc
,
filename
);
ReleaseDC
(
0
,
hdc
);
if
(
hbitmapWallPaper
)
DeleteObject
(
hbitmapWallPaper
);
hbitmapWallPaper
=
hbitmap
;
fTileWallPaper
=
GetProfileIntA
(
"desktop"
,
"TileWallPaper"
,
0
);
if
(
hbitmap
)
{
BITMAP
bmp
;
GetObjectA
(
hbitmap
,
sizeof
(
bmp
),
&
bmp
);
bitmapSize
.
cx
=
(
bmp
.
bmWidth
!=
0
)
?
bmp
.
bmWidth
:
1
;
bitmapSize
.
cy
=
(
bmp
.
bmHeight
!=
0
)
?
bmp
.
bmHeight
:
1
;
}
return
TRUE
;
return
SystemParametersInfoA
(
SPI_SETDESKWALLPAPER
,
MAX_PATH
,
(
void
*
)
filename
,
SPIF_UPDATEINIFILE
);
}
...
...
@@ -238,5 +201,6 @@ BOOL DESKTOP_SetPattern( LPCWSTR pattern )
DeleteObject
(
hbitmap
);
}
}
init_wallpaper
();
return
TRUE
;
}
programs/explorer/desktop.c
View file @
b2fa004e
...
...
@@ -312,7 +312,6 @@ void manage_desktop( WCHAR *arg )
SendMessageW
(
hwnd
,
WM_SETICON
,
ICON_BIG
,
(
LPARAM
)
LoadIconW
(
0
,
MAKEINTRESOURCEW
(
OIC_WINLOGO
)));
if
(
name
)
set_desktop_window_title
(
hwnd
,
name
);
SystemParametersInfoA
(
SPI_SETDESKPATTERN
,
-
1
,
NULL
,
FALSE
);
SetDeskWallPaper
(
(
LPSTR
)
-
1
);
ClipCursor
(
NULL
);
initialize_display_settings
(
hwnd
);
initialize_appbar
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment