[DESK.CPL]
authorThomas Faber <thomas.faber@reactos.org>
Wed, 25 Feb 2015 13:24:13 +0000 (13:24 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Wed, 25 Feb 2015 13:24:13 +0000 (13:24 +0000)
- Don't convert the selected wallpaper if it is already a bitmap. Patch by Ricardo Hanke.
CORE-8802 #resolve

svn path=/trunk/; revision=66451

reactos/dll/cpl/desk/CMakeLists.txt
reactos/dll/cpl/desk/background.c
reactos/dll/cpl/desk/guid.c [new file with mode: 0644]

index 41f5a5e..ffa2cea 100644 (file)
@@ -25,6 +25,7 @@ list(APPEND SOURCE
 
 add_library(desk SHARED
     ${SOURCE}
+    guid.c
     desk.rc
     ${CMAKE_CURRENT_BINARY_DIR}/desk.def)
 
index ae660bd..b46bcf3 100644 (file)
@@ -913,6 +913,7 @@ SetWallpaper(PDATA pData)
     TCHAR szWallpaper[MAX_PATH];
     GpImage *image;
     CLSID  encoderClsid;
+    GUID guidFormat;
     size_t length = 0;
     GpStatus status;
 
@@ -956,6 +957,15 @@ SetWallpaper(PDATA pData)
             return;
         }
 
+        GdipGetImageRawFormat(image, &guidFormat);
+        if (IsEqualGUID(&guidFormat, &ImageFormatBMP))
+        {
+            GdipDisposeImage(image);
+            RegCloseKey(regKey);
+            SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, pData->backgroundItems[pData->backgroundSelection].szFilename, SPIF_UPDATEINIFILE);
+            return;
+        }
+
         if (FAILED(GdipGetEncoderClsid(L"image/bmp", &encoderClsid)))
         {
             GdipDisposeImage(image);
diff --git a/reactos/dll/cpl/desk/guid.c b/reactos/dll/cpl/desk/guid.c
new file mode 100644 (file)
index 0000000..90adf66
--- /dev/null
@@ -0,0 +1,14 @@
+/* DO NOT USE THE PRECOMPILED HEADER FOR THIS FILE! */
+
+#define WIN32_NO_STATuS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
+#include <windef.h>
+#include <winbase.h>
+#include <wingdi.h>
+#include <objbase.h>
+#include <initguid.h>
+#include <gdiplus.h>
+
+/* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */