(PATCH) SPI_GETDESKWALLPAPER Implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

this is my first real patch for Wine. It implements the SystemParametersInfo 
SPI_GETDESKWALLPAPER action and fixes SPI_SETDESKWALLPAPER so it updates the 
Wallpaper entry in the registry. (Wine Bug-Tasklet #461)
I've also included a simple test for these two actions. Please tell me if 
something is wrong so I can fix it. :-)

ChangeLog:
* windows/sysparams.c:
Implemented SPI_GETDESKWALLPAPER action, fixed SPI_SETDESKWALLPAPER

* dlls/user/tests/sysparams.c
Added test for wallpaper actions

License: X11 / LGPL

Philipp Wollermann
? documentation/wine-devel
Index: dlls/user/tests/sysparams.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/sysparams.c,v
retrieving revision 1.6
diff -u -3 -p -r1.6 sysparams.c
--- dlls/user/tests/sysparams.c	31 May 2002 23:40:54 -0000	1.6
+++ dlls/user/tests/sysparams.c	23 Jun 2002 15:13:26 -0000
@@ -82,6 +82,8 @@ static int has_unicode(void) { return 1;
 #define SPI_SETFASTTASKSWITCH_VALNAME           "CoolSwitch"
 #define SPI_SETDRAGFULLWINDOWS_REGKEY           "Control Panel\\Desktop"
 #define SPI_SETDRAGFULLWINDOWS_VALNAME          "DragFullWindows"
+#define SPI_SETDESKWALLPAPER_REGKEY		"Control Panel\\Desktop"
+#define SPI_SETDESKWALLPAPER_VALNAME		"Wallpaper"
 /* FIXME - don't have access to Windows with this action (W95, NT5.0). Set real values */
 #define SPI_SETKEYBOARDPREF_REGKEY      "Control Panel\\Desktop"
 #define SPI_SETKEYBOARDPREF_VALNAME     "WINE_WorkArea"
@@ -984,6 +986,24 @@ static void test_SPI_SETSCREENREADER( vo
     /* TODO!!! - don't have version of Windows which has this */
 }
 
+static void test_SPI_SETWALLPAPER( void )              /*   115 */
+{
+#if (_WIN32_WINNT >= 0x500) || (_WIN32_WINDOW > 0x400)
+    char oldval[260];
+    char newval[260];
+    trace("testing SPI_{GET,SET}DESKWALLPAPER\n");
+    
+    SystemParametersInfoA(SPI_GETDESKWALLPAPER, 260, oldval, 0);
+    test_reg_key(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, oldval);
+
+    strcpy(newval, "");
+    SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, newval, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
+    test_change_message(SPI_SETDESKWALLPAPER, "");
+		    
+    SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, oldval, SPIF_UPDATEINIFILE);
+#endif
+}
+
 /*
  * Registry entries for the system parameters.
  * Names are created by 'SET' flags names.
@@ -1013,6 +1033,7 @@ static DWORD WINAPI SysParamsThreadFunc(
     test_SPI_SETSHOWSOUNDS();                   /*     57 */
     test_SPI_SETKEYBOARDPREF();                 /*     69 */
     test_SPI_SETSCREENREADER();                 /*     71 */
+    test_SPI_SETWALLPAPER();			/*    115 */
     SendMessageA( ghTestWnd, WM_DESTROY, 0, 0 );
     return 0;
 }
Index: windows/sysparams.c
===================================================================
RCS file: /home/wine/wine/windows/sysparams.c,v
retrieving revision 1.39
diff -u -3 -p -r1.39 sysparams.c
--- windows/sysparams.c	31 May 2002 23:06:54 -0000	1.39
+++ windows/sysparams.c	23 Jun 2002 15:13:29 -0000
@@ -109,6 +109,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(system);
 #define SPI_SETWORKAREA_VALNAME                 "WINE_WorkArea"
 #define SPI_SETSHOWSOUNDS_REGKEY        "Control Panel\\Accessibility\\ShowSounds"
 #define SPI_SETSHOWSOUNDS_VALNAME       "On"
+#define SPI_SETDESKWALLPAPER_REGKEY	"Control Panel\\Desktop"
+#define SPI_SETDESKWALLPAPER_VALNAME	"Wallpaper"
 /* FIXME - real values */
 #define SPI_SETKEYBOARDPREF_REGKEY      "Control Panel\\Desktop"
 #define SPI_SETKEYBOARDPREF_VALNAME     "WINE_KeyboardPref"
@@ -836,6 +838,7 @@ BOOL WINAPI SystemParametersInfoA( UINT 
     }
 
     case SPI_SETDESKWALLPAPER:			/*     20 */
+        SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, pvParam, fWinIni);
 	ret = SetDeskWallPaper( (LPSTR)pvParam );
 	break;
     case SPI_SETDESKPATTERN:			/*     21 */
@@ -1661,7 +1664,28 @@ BOOL WINAPI SystemParametersInfoA( UINT 
 	*(BOOL *)pvParam = screensaver_running;
         break;
 
-    WINE_SPI_FIXME(SPI_GETDESKWALLPAPER);       /*    115  _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
+    case SPI_GETDESKWALLPAPER:                  /*    115  _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
+    {
+	char buf[MAX_PATH];
+
+        if (uiParam > MAX_PATH)
+	{
+	    uiParam = MAX_PATH;
+	}
+	
+        if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, buf))
+	{
+	    strncpy((char*)pvParam, buf, uiParam);
+	}
+	else
+	{
+	    // Return an empty string
+	    memset((char*)pvParam, 0, uiParam);
+	}
+
+	break;
+    }
+	
     WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING);/* 0x1000  _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
     WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING);/* 0x1001  _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
     WINE_SPI_FIXME(SPI_GETMENUANIMATION);       /* 0x1002  _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux