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

[wmx] configurable Border

Johannes Zellner - Sat Feb 13 20:01:12 1999


Here's a patch which implements a configurable background:
If a file $(HOME)/.wmx/background.xpm is found, it is used for
the Border pixmap, otherwise the compiled-in-pixmap is used.

The patch builds on wmx-5sec3pl6.tar.gz

-- joze

--- ./Border.C.orig	Sat Feb 13 19:14:57 1999
+++ ./Border.C	Sat Feb 13 19:51:50 1999
@@ -153,10 +153,34 @@
 
 #if CONFIG_USE_PIXMAPS != False
     if (CONFIG_USE_PIXMAPS) {
+        int use_dynamic = True;
 	XpmAttributes attrs;
 	attrs.valuemask = 0L;
-	if (XpmCreatePixmapFromData(wm->display(), wm->root(), background,
-				    &m_backgroundPixmap, NULL, &attrs)
+        char *home = getenv ("HOME");
+        if (home) {
+            char *pixMapPath = (char *) malloc (sizeof (char) * (strlen (home)
+                                  + strlen (CONFIG_COMMAND_MENU) + 20));
+            if (pixMapPath) {
+                strcpy (pixMapPath, home);
+                strcat (pixMapPath, "/");
+                strcat (pixMapPath, CONFIG_COMMAND_MENU);
+                strcat (pixMapPath, "/background.xpm");
+
+                // look for background pixmap file in
+                // the users .wmx directory. It is *not*
+                // an error, if none is found. (joze)
+                // 
+                if (XpmReadFileToPixmap (wm->display(), wm->root(), pixMapPath,
+                                         &m_backgroundPixmap, NULL, &attrs)
+                    != XpmSuccess) {
+                    use_dynamic = False;
+                }
+                free (pixMapPath);
+            }
+        }
+        if (use_dynamic == False
+            && XpmCreatePixmapFromData (wm->display(), wm->root(), background,
+                                       &m_backgroundPixmap, NULL, &attrs)
 	    != XpmSuccess) {
 	    fprintf(stderr, "wmx: couldn't create background pixmap\n"); 
 	    m_backgroundPixmap = None;



Next: